diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 3a3e2b9b..7336db13 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -48,7 +48,7 @@ class BaseAppClient { if (body['EditedBy'] == '') { body.remove("EditedBy"); } - body['TokenID'] = body.containsKey('TokenID') && body['TokenID'] != null ? body['TokenID'] : token ?? ''; + body['TokenID'] = token ?? ''; String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') body['LanguageID'] = 1; @@ -72,10 +72,10 @@ class BaseAppClient { await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); } - // int projectID = await sharedPref.getInt(PROJECT_ID); - // if (projectID == 2 || projectID == 3) - // body['PatientOutSA'] = true; - // else + //int projectID = await sharedPref.getInt(PROJECT_ID); + //if (projectID == 2 || projectID == 3) + // body['PatientOutSA'] = true; + //else body['PatientOutSA'] = false; body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; diff --git a/lib/config/config.dart b/lib/config/config.dart index 72e2db07..0e8106bc 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -289,6 +289,12 @@ const PATIENT_MEDICAL_REPORT_GET_TEMPLATE = "Services/Patients.svc/REST/DAPP_Get const PATIENT_MEDICAL_REPORT_INSERT = "Services/Patients.svc/REST/DAPP_InsertMedicalReport"; const PATIENT_MEDICAL_REPORT_VERIFIED = "Services/Patients.svc/REST/DAPP_VerifiedMedicalReport"; +const GET_PROCEDURE_TEMPLETE = + 'Services/Doctors.svc/REST/DAPP_ProcedureTemplateGet'; + +const GET_PROCEDURE_TEMPLETE_DETAILS = + "Services/Doctors.svc/REST/DAPP_ProcedureTemplateDetailsGet"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/core/model/procedure/Procedure_template_request_model.dart b/lib/core/model/procedure/Procedure_template_request_model.dart new file mode 100644 index 00000000..698178e3 --- /dev/null +++ b/lib/core/model/procedure/Procedure_template_request_model.dart @@ -0,0 +1,120 @@ +class ProcedureTempleteRequestModel { + int doctorID; + String firstName; + String middleName; + String lastName; + String patientMobileNumber; + String patientIdentificationID; + int patientID; + String from; + String to; + int searchType; + String mobileNo; + String identificationNo; + int editedBy; + int projectID; + int clinicID; + String tokenID; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + String vidaAuthTokenID; + String vidaRefreshTokenID; + int deviceTypeID; + + ProcedureTempleteRequestModel( + {this.doctorID, + this.firstName, + this.middleName, + this.lastName, + this.patientMobileNumber, + this.patientIdentificationID, + this.patientID, + this.from, + this.to, + this.searchType, + this.mobileNo, + this.identificationNo, + this.editedBy, + this.projectID, + this.clinicID, + this.tokenID, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA, + this.vidaAuthTokenID, + this.vidaRefreshTokenID, + this.deviceTypeID}); + + ProcedureTempleteRequestModel.fromJson(Map json) { + doctorID = json['DoctorID']; + firstName = json['FirstName']; + middleName = json['MiddleName']; + lastName = json['LastName']; + patientMobileNumber = json['PatientMobileNumber']; + patientIdentificationID = json['PatientIdentificationID']; + patientID = json['PatientID']; + from = json['From']; + to = json['To']; + searchType = json['SearchType']; + mobileNo = json['MobileNo']; + identificationNo = json['IdentificationNo']; + editedBy = json['EditedBy']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + tokenID = json['TokenID']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['DoctorID'] = this.doctorID; + data['FirstName'] = this.firstName; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['PatientID'] = this.patientID; + data['From'] = this.from; + data['To'] = this.to; + data['SearchType'] = this.searchType; + data['MobileNo'] = this.mobileNo; + data['IdentificationNo'] = this.identificationNo; + data['EditedBy'] = this.editedBy; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['TokenID'] = this.tokenID; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/model/procedure/procedure_templateModel.dart b/lib/core/model/procedure/procedure_templateModel.dart new file mode 100644 index 00000000..3b12d646 --- /dev/null +++ b/lib/core/model/procedure/procedure_templateModel.dart @@ -0,0 +1,56 @@ +class ProcedureTempleteModel { + String setupID; + int projectID; + int clinicID; + int doctorID; + int templateID; + String templateName; + bool isActive; + int createdBy; + String createdOn; + dynamic editedBy; + dynamic editedOn; + + ProcedureTempleteModel( + {this.setupID, + this.projectID, + this.clinicID, + this.doctorID, + this.templateID, + this.templateName, + this.isActive, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn}); + + ProcedureTempleteModel.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + templateID = json['TemplateID']; + templateName = json['TemplateName']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['TemplateID'] = this.templateID; + data['TemplateName'] = this.templateName; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + return data; + } +} diff --git a/lib/core/model/procedure/procedure_template_details_model.dart b/lib/core/model/procedure/procedure_template_details_model.dart new file mode 100644 index 00000000..84f97b65 --- /dev/null +++ b/lib/core/model/procedure/procedure_template_details_model.dart @@ -0,0 +1,84 @@ +class ProcedureTempleteDetailsModel { + String setupID; + int projectID; + int clinicID; + int doctorID; + int templateID; + String procedureID; + bool isActive; + int createdBy; + String createdOn; + dynamic editedBy; + dynamic editedOn; + String procedureName; + String procedureNameN; + String alias; + String aliasN; + String categoryID; + String subGroupID; + dynamic riskCategoryID; + + ProcedureTempleteDetailsModel( + {this.setupID, + this.projectID, + this.clinicID, + this.doctorID, + this.templateID, + this.procedureID, + this.isActive, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.procedureName, + this.procedureNameN, + this.alias, + this.aliasN, + this.categoryID, + this.subGroupID, + this.riskCategoryID}); + + ProcedureTempleteDetailsModel.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + templateID = json['TemplateID']; + procedureID = json['ProcedureID']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + procedureName = json['ProcedureName']; + procedureNameN = json['ProcedureNameN']; + alias = json['Alias']; + aliasN = json['AliasN']; + categoryID = json['CategoryID']; + subGroupID = json['SubGroupID']; + riskCategoryID = json['RiskCategoryID']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['TemplateID'] = this.templateID; + data['ProcedureID'] = this.procedureID; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + data['ProcedureName'] = this.procedureName; + data['ProcedureNameN'] = this.procedureNameN; + data['Alias'] = this.alias; + data['AliasN'] = this.aliasN; + data['CategoryID'] = this.categoryID; + data['SubGroupID'] = this.subGroupID; + data['RiskCategoryID'] = this.riskCategoryID; + return data; + } +} diff --git a/lib/core/model/procedure/procedure_template_details_request_model.dart b/lib/core/model/procedure/procedure_template_details_request_model.dart new file mode 100644 index 00000000..6df6fc73 --- /dev/null +++ b/lib/core/model/procedure/procedure_template_details_request_model.dart @@ -0,0 +1,124 @@ +class ProcedureTempleteDetailsRequestModel { + int doctorID; + String firstName; + int templateID; + String middleName; + String lastName; + String patientMobileNumber; + String patientIdentificationID; + int patientID; + String from; + String to; + int searchType; + String mobileNo; + String identificationNo; + int editedBy; + int projectID; + int clinicID; + String tokenID; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + String vidaAuthTokenID; + String vidaRefreshTokenID; + int deviceTypeID; + + ProcedureTempleteDetailsRequestModel( + {this.doctorID, + this.firstName, + this.templateID, + this.middleName, + this.lastName, + this.patientMobileNumber, + this.patientIdentificationID, + this.patientID, + this.from, + this.to, + this.searchType, + this.mobileNo, + this.identificationNo, + this.editedBy, + this.projectID, + this.clinicID, + this.tokenID, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA, + this.vidaAuthTokenID, + this.vidaRefreshTokenID, + this.deviceTypeID}); + + ProcedureTempleteDetailsRequestModel.fromJson(Map json) { + doctorID = json['DoctorID']; + firstName = json['FirstName']; + templateID = json['TemplateID']; + middleName = json['MiddleName']; + lastName = json['LastName']; + patientMobileNumber = json['PatientMobileNumber']; + patientIdentificationID = json['PatientIdentificationID']; + patientID = json['PatientID']; + from = json['From']; + to = json['To']; + searchType = json['SearchType']; + mobileNo = json['MobileNo']; + identificationNo = json['IdentificationNo']; + editedBy = json['EditedBy']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + tokenID = json['TokenID']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['DoctorID'] = this.doctorID; + data['FirstName'] = this.firstName; + data['TemplateID'] = this.templateID; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['PatientID'] = this.patientID; + data['From'] = this.from; + data['To'] = this.to; + data['SearchType'] = this.searchType; + data['MobileNo'] = this.mobileNo; + data['IdentificationNo'] = this.identificationNo; + data['EditedBy'] = this.editedBy; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['TokenID'] = this.tokenID; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index b403edf0..9673b9bf 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -1,9 +1,13 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/procedure/Procedure_template_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; @@ -19,9 +23,21 @@ class ProcedureService extends BaseService { List procedureslist = List(); List categoryList = []; + List _templateList = List(); + List get templateList => _templateList; + + List _templateDetailsList = List(); + List get templateDetailsList => + _templateDetailsList; + GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(); + ProcedureTempleteRequestModel _procedureTempleteRequestModel = + ProcedureTempleteRequestModel(); + ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = + ProcedureTempleteDetailsRequestModel(); + GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( // clinicId: 17, // pageSize: 10, @@ -46,6 +62,51 @@ class ProcedureService extends BaseService { //search: ["DENTAL"], ); + Future getProcedureTemplate( + {int doctorId, int projectId, int clinicId}) async { + _procedureTempleteRequestModel = ProcedureTempleteRequestModel( + tokenID: "@dm!n", + patientID: 0, + searchType: 1, + editedBy: 208195, + ); + hasError = false; + //insuranceApprovalInPatient.clear(); + + await baseAppClient.post(GET_PROCEDURE_TEMPLETE, + onSuccess: (dynamic response, int statusCode) { + //prescriptionsList.clear(); + response['HIS_ProcedureTemplateList'].forEach((template) { + _templateList.add(ProcedureTempleteModel.fromJson(template)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _procedureTempleteRequestModel.toJson()); + } + + Future getProcedureTemplateDetails( + {int doctorId, int projectId, int clinicId, int templateId}) async { + _procedureTempleteDetailsRequestModel = + ProcedureTempleteDetailsRequestModel( + templateID: templateId, searchType: 1, patientID: 0); + hasError = false; + //insuranceApprovalInPatient.clear(); + _templateDetailsList.clear(); + + await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, + onSuccess: (dynamic response, int statusCode) { + //prescriptionsList.clear(); + response['HIS_ProcedureTemplateDetailsList'].forEach((template) { + _templateDetailsList + .add(ProcedureTempleteDetailsModel.fromJson(template)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _procedureTempleteDetailsRequestModel.toJson()); + } + Future getProcedure({int mrn}) async { _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(patientMRN: mrn); diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 8e6f8989..4f9a7cf6 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -7,6 +7,8 @@ import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.da import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; @@ -48,6 +50,10 @@ class ProcedureViewModel extends BaseViewModel { List get labOrdersResultsList => _labsService.labOrdersResultsList; + List get procedureTemplate => + _procedureService.templateList; + List get procedureTemplateDetails => + _procedureService.templateDetailsList; List _patientLabOrdersListClinic = List(); List _patientLabOrdersListHospital = List(); @@ -92,6 +98,32 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getProcedureTemplate() async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.getProcedureTemplate(); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + int tempId = 0; + Future getProcedureTemplateDetails({int templateId}) async { + tempId = templateId; + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.getProcedureTemplateDetails(templateId: templateId); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + Future postProcedure( PostProcedureReqModel postProcedureReqModel, int mrn) async { hasError = false; diff --git a/lib/screens/procedures/ProcedureCard.dart b/lib/screens/procedures/ProcedureCard.dart index f18422ee..0c3d952f 100644 --- a/lib/screens/procedures/ProcedureCard.dart +++ b/lib/screens/procedures/ProcedureCard.dart @@ -1,4 +1,5 @@ //import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; @@ -32,7 +33,7 @@ class ProcedureCard extends StatelessWidget { return Container( width: double.maxFinite, - height: MediaQuery.of(context).size.height * .22, + //height: MediaQuery.of(context).size.height * .22, margin: EdgeInsets.all(10), padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), decoration: BoxDecoration( @@ -129,33 +130,93 @@ class ProcedureCard extends StatelessWidget { ), ], ), + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).doctorName + ": ", + // //color: Colors.grey, + // fontSize: 12, + // color: Colors.grey, + // ), + // AppText( + // entityList.doctorName.toString(), + // fontSize: 12, + // bold: true, + // ), + // ], + // ), + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).clinic + ": ", + // //color: Colors.grey, + // fontSize: 12, + // color: Colors.grey, + // ), + // AppText( + // entityList.clinicDescription ?? "", + // bold: true, + // fontSize: 12, + // ), + // ], + // ), Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( - TranslationBase.of(context).doctorName + ": ", - //color: Colors.grey, - fontSize: 12, - color: Colors.grey, - ), - AppText( - entityList.doctorName.toString(), - fontSize: 12, - bold: true, + Container( + margin: EdgeInsets.only(left: 10, right: 0), + child: Image.asset( + 'assets/images/patient/ic_ref_arrow_left.png', + height: 50, + width: 30, + ), ), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).clinic + ": ", - //color: Colors.grey, - fontSize: 12, - color: Colors.grey, + Container( + margin: EdgeInsets.only( + left: 0, top: 25, right: 0, bottom: 0), + padding: EdgeInsets.only(left: 4.0, right: 4.0), + child: Container( + width: 40, + height: 40, + child: ClipRRect( + borderRadius: BorderRadius.circular(20.0), + child: Image.network( + 'assets/images/male_avatar.png', + height: 25, + width: 30, + errorBuilder: (BuildContext context, + Object exception, + StackTrace stackTrace) { + return Text('No Image'); + }, + ))), ), - AppText( - entityList.clinicDescription ?? "", - bold: true, - fontSize: 12, + Expanded( + flex: 4, + child: Container( + margin: EdgeInsets.only( + left: 10, top: 25, right: 10, bottom: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + entityList.doctorName, + fontFamily: 'Poppins', + fontWeight: FontWeight.w800, + fontSize: 1.7 * SizeConfig.textMultiplier, + color: Colors.black, + ), + if (entityList.clinicDescription != null) + AppText( + entityList.clinicDescription, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.4 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + ], + ), + ), ), ], ), diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart new file mode 100644 index 00000000..89a382ad --- /dev/null +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -0,0 +1,147 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart'; +import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/cupertino.dart'; + +class AddFavouriteProcedure extends StatefulWidget { + final ProcedureViewModel model; + final PatiantInformtion patient; + + const AddFavouriteProcedure({Key key, this.model, this.patient}) + : super(key: key); + @override + _AddFavouriteProcedureState createState() => _AddFavouriteProcedureState(); +} + +class _AddFavouriteProcedureState extends State { + _AddFavouriteProcedureState({this.patient, this.model}); + ProcedureViewModel model; + PatiantInformtion patient; + List entityList = List(); + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async { + if (model.procedureTemplate.length == 0) { + model.getProcedureTemplate(); + } + }, + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + isShowAppBar: false, + body: Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + if (model.procedureTemplate.length != 0) + Expanded( + child: NetworkBaseView( + baseViewModel: model, + child: + // selectedCategory != null + // ? selectedCategory['categoryId'] == 02 || + // selectedCategory['categoryId'] == 03 + // ? + EntityListCheckboxSearchFavProceduresWidget( + model: widget.model, + masterList: widget.model.procedureTemplate, + removeFavProcedure: (item) { + setState(() { + entityList.remove(item); + }); + }, + addFavProcedure: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityFavListSelected: (master) => + isEntityListSelected(master), + ) + // : ProcedureListWidget( + // model: widget.model, + // masterList: widget.model + // .categoriesList[0].entityList, + // removeHistory: (item) { + // setState(() { + // entityList.remove(item); + // }); + // }, + // addHistory: (history) { + // setState(() { + // entityList.add(history); + // }); + // }, + // addSelectedHistories: () { + // //TODO build your fun herr + // // widget.addSelectedHistories(); + // }, + // isEntityListSelected: (master) => + // isEntityListSelected(master), + // ) + // : null, + ), + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context).addSelectedProcedures, + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () { + //print(entityList.toString()); + onPressed: + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .fillTheMandatoryProcedureDetails, + ); + return; + } + + Navigator.pop(context); + // postProcedure( + // orderType: selectedType.toString(), + // entityList: entityList, + // patient: patient, + // model: widget.model, + // remarks: remarksController.text); + }, + ), + ], + ), + ), + ], + ), + ), + ); + } + + bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) { + Iterable history = entityList + .where((element) => masterKey.templateID == element.templateID); + if (history.length > 0) { + return true; + } + return false; + } +} diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart index df748922..2b62d2bf 100644 --- a/lib/screens/procedures/add-procedure-form.dart +++ b/lib/screens/procedures/add-procedure-form.dart @@ -145,307 +145,313 @@ class _AddSelectedProcedureState extends State { builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: false, - body: NetworkBaseView( - baseViewModel: model, - child: DraggableScrollableSheet( - minChildSize: 0.90, - initialChildSize: 0.95, - maxChildSize: 1.0, - builder: - (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 1.20, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + body: Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + Expanded( + child: NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: (BuildContext context, + ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( - TranslationBase.of(context) - .pleaseEnterProcedure, - fontWeight: FontWeight.w700, - fontSize: 20, + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + AppText( + TranslationBase.of(context) + .pleaseEnterProcedure, + fontWeight: FontWeight.w700, + fontSize: 20, + ), + ]), + SizedBox( + height: + MediaQuery.of(context).size.height * 0.04, ), - InkWell( - child: Icon( - Icons.close, - size: 24.0, - ), - onTap: () { - Navigator.pop(context); - }, - ) - ]), - SizedBox( - height: MediaQuery.of(context).size.height * 0.04, - ), - Row( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.85, - child: AppTextFieldCustom( - hintText: TranslationBase.of(context) - .searchProcedureHere, - isTextFieldHasSuffix: false, + Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * + 0.81, + child: AppTextFieldCustom( + hintText: TranslationBase.of(context) + .searchProcedureHere, + isTextFieldHasSuffix: false, - maxLines: 1, - minLines: 1, - hasBorder: true, - controller: procedureName, - // onSubmitted: (_) { - // model.getProcedureCategory( - // categoryName: procedureName.text); - // }, - onClick: () { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) - model.getProcedureCategory( - categoryName: procedureName.text); - else - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .atLeastThreeCharacters, - ); - }, + maxLines: 1, + minLines: 1, + hasBorder: true, + controller: procedureName, + // onSubmitted: (_) { + // model.getProcedureCategory( + // categoryName: procedureName.text); + // }, + onClick: () { + if (procedureName.text.isNotEmpty && + procedureName.text.length >= 3) + model.getProcedureCategory( + categoryName: + procedureName.text); + else + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .atLeastThreeCharacters, + ); + }, + ), + ), + SizedBox( + width: MediaQuery.of(context).size.width * + 0.02, + ), + InkWell( + onTap: () { + if (procedureName.text.isNotEmpty && + procedureName.text.length >= 3) + model.getProcedureCategory( + categoryName: procedureName.text); + else + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .atLeastThreeCharacters, + ); + }, + child: Icon( + Icons.search, + size: 25.0, + ), + ), + ], ), - ), - SizedBox( - width: MediaQuery.of(context).size.width * 0.02, - ), - InkWell( - onTap: () { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) - model.getProcedureCategory( - categoryName: procedureName.text); - else - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .atLeastThreeCharacters, - ); - }, - child: Icon( - Icons.search, - size: 25.0, + // SizedBox( + // width: MediaQuery.of(context).size.width * 0.29, + // ), + // InkWell( + // child: Icon( + // Icons.close, + // size: 24.0, + // ), + // onTap: () { + // Navigator.pop(context); + // }, + // ), + // ], + // ), + // SizedBox( + // height: 10.0, + // ), + // Container( + // height: screenSize.height * 0.070, + // child: InkWell( + // onTap: model.categoryList != null && + // model.categoryList.length > 0 + // ? () { + // ListSelectDialog dialog = + // ListSelectDialog( + // list: model.categoryList, + // attributeName: 'categoryName', + // attributeValueId: 'categoryId', + // okText: TranslationBase.of(context).ok, + // okFunction: (selectedValue) { + // setState(() { + // selectedCategory = selectedValue; + // model.getProcedureCategory( + // categoryName: selectedCategory[ + // 'categoryName'], + // categoryID: selectedCategory[ + // 'categoryId'] <= + // 9 + // ? "0" + + // selectedCategory[ + // 'categoryId'] + // .toString() + // : selectedCategory[ + // 'categoryId'] + // .toString()); + // }); + // }, + // ); + // showDialog( + // barrierDismissible: false, + // context: context, + // builder: (BuildContext context) { + // return dialog; + // }, + // ); + // //model.getProcedureCategory(); + // } + // : null, + // child: TextField( + // decoration: textFieldSelectorDecoration( + // TranslationBase.of(context) + // .procedureCategorise, + // selectedCategory != null + // ? selectedCategory['categoryName'] + // : null, + // true, + // suffixIcon: Icon( + // Icons.search, + // color: Colors.black, + // )), + // enabled: false, + // ), + // ), + // ), + if (procedureName.text.isNotEmpty && + model.procedureList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: + // selectedCategory != null + // ? selectedCategory['categoryId'] == 02 || + // selectedCategory['categoryId'] == 03 + // ? + EntityListCheckboxSearchWidget( + model: widget.model, + masterList: widget + .model.categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + ) + // : ProcedureListWidget( + // model: widget.model, + // masterList: widget.model + // .categoriesList[0].entityList, + // removeHistory: (item) { + // setState(() { + // entityList.remove(item); + // }); + // }, + // addHistory: (history) { + // setState(() { + // entityList.add(history); + // }); + // }, + // addSelectedHistories: () { + // //TODO build your fun herr + // // widget.addSelectedHistories(); + // }, + // isEntityListSelected: (master) => + // isEntityListSelected(master), + // ) + // : null, + ), + SizedBox( + height: 15.0, ), - ), - ], - ), - // SizedBox( - // width: MediaQuery.of(context).size.width * 0.29, - // ), - // InkWell( - // child: Icon( - // Icons.close, - // size: 24.0, - // ), - // onTap: () { - // Navigator.pop(context); - // }, - // ), - // ], - // ), - // SizedBox( - // height: 10.0, - // ), - // Container( - // height: screenSize.height * 0.070, - // child: InkWell( - // onTap: model.categoryList != null && - // model.categoryList.length > 0 - // ? () { - // ListSelectDialog dialog = - // ListSelectDialog( - // list: model.categoryList, - // attributeName: 'categoryName', - // attributeValueId: 'categoryId', - // okText: TranslationBase.of(context).ok, - // okFunction: (selectedValue) { - // setState(() { - // selectedCategory = selectedValue; - // model.getProcedureCategory( - // categoryName: selectedCategory[ - // 'categoryName'], - // categoryID: selectedCategory[ - // 'categoryId'] <= - // 9 - // ? "0" + - // selectedCategory[ - // 'categoryId'] - // .toString() - // : selectedCategory[ - // 'categoryId'] - // .toString()); - // }); - // }, - // ); - // showDialog( - // barrierDismissible: false, - // context: context, - // builder: (BuildContext context) { - // return dialog; - // }, - // ); - // //model.getProcedureCategory(); - // } - // : null, - // child: TextField( - // decoration: textFieldSelectorDecoration( - // TranslationBase.of(context) - // .procedureCategorise, - // selectedCategory != null - // ? selectedCategory['categoryName'] - // : null, - // true, - // suffixIcon: Icon( - // Icons.search, - // color: Colors.black, - // )), - // enabled: false, - // ), - // ), - // ), - if (procedureName.text.isNotEmpty && - model.procedureList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: - // selectedCategory != null - // ? selectedCategory['categoryId'] == 02 || - // selectedCategory['categoryId'] == 03 - // ? - EntityListCheckboxSearchWidget( - model: widget.model, - masterList: - widget.model.categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), + Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + // Container( + // child: Row( + // children: [ + // AppText( + // TranslationBase.of(context).orderType), + // Radio( + // activeColor: Color(0xFFB9382C), + // value: 1, + // groupValue: selectedType, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text('routine'), + // Radio( + // activeColor: Color(0xFFB9382C), + // groupValue: selectedType, + // value: 0, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text(TranslationBase.of(context).urgent), + // ], + // ), + // ), + // SizedBox( + // height: 15.0, + // ), + // TextFields( + // hintText: TranslationBase.of(context).remarks, + // controller: remarksController, + // minLines: 3, + // maxLines: 5, + // ), + SizedBox( + height: 100.0, + ), + ], ) - // : ProcedureListWidget( - // model: widget.model, - // masterList: widget.model - // .categoriesList[0].entityList, - // removeHistory: (item) { - // setState(() { - // entityList.remove(item); - // }); - // }, - // addHistory: (history) { - // setState(() { - // entityList.add(history); - // }); - // }, - // addSelectedHistories: () { - // //TODO build your fun herr - // // widget.addSelectedHistories(); - // }, - // isEntityListSelected: (master) => - // isEntityListSelected(master), - // ) - // : null, - ), - SizedBox( - height: 15.0, + ], + ), ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - // Container( - // child: Row( - // children: [ - // AppText( - // TranslationBase.of(context).orderType), - // Radio( - // activeColor: Color(0xFFB9382C), - // value: 1, - // groupValue: selectedType, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text('routine'), - // Radio( - // activeColor: Color(0xFFB9382C), - // groupValue: selectedType, - // value: 0, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text(TranslationBase.of(context).urgent), - // ], - // ), - // ), - // SizedBox( - // height: 15.0, - // ), - // TextFields( - // hintText: TranslationBase.of(context).remarks, - // controller: remarksController, - // minLines: 3, - // maxLines: 5, - // ), - SizedBox( - height: 100.0, - ), - ], - ) - ], - ), - ), - ), - ); - }), - ), - bottomSheet: Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context).addSelectedProcedures, - color: Color(0xff359846), - fontWeight: FontWeight.w700, - onPressed: () { - //print(entityList.toString()); - onPressed: - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, - ); - return; - } + ), + ); + }), + ), + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context).addSelectedProcedures, + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () { + //print(entityList.toString()); + onPressed: + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .fillTheMandatoryProcedureDetails, + ); + return; + } - Navigator.pop(context); - postProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - model: widget.model, - remarks: remarksController.text); - }, + Navigator.pop(context); + postProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + model: widget.model, + remarks: remarksController.text); + }, + ), + ], ), - ], - ), + ), + ], ), ), ); diff --git a/lib/screens/procedures/add_procedure_homeScreen.dart b/lib/screens/procedures/add_procedure_homeScreen.dart new file mode 100644 index 00000000..de242cd7 --- /dev/null +++ b/lib/screens/procedures/add_procedure_homeScreen.dart @@ -0,0 +1,216 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/procedures/add-favourite-procedure.dart'; +import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class AddProcedureHome extends StatefulWidget { + final ProcedureViewModel model; + final PatiantInformtion patient; + const AddProcedureHome({Key key, this.model, this.patient}) : super(key: key); + @override + _AddProcedureHomeState createState() => + _AddProcedureHomeState(patient: patient, model: model); +} + +class _AddProcedureHomeState extends State + with SingleTickerProviderStateMixin { + _AddProcedureHomeState({this.patient, this.model}); + ProcedureViewModel model; + PatiantInformtion patient; + TabController _tabController; + int _activeTab = 0; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + _tabController.addListener(_handleTabSelection); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + _handleTabSelection() { + setState(() { + _activeTab = _tabController.index; + }); + } + + @override + Widget build(BuildContext context) { + //final routeArgs = ModalRoute.of(context).settings.arguments as Map; + //PatiantInformtion patient = routeArgs['patient']; + final screenSize = MediaQuery.of(context).size; + return BaseView( + //onModelReady: (model) => model.getCategory(), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + isShowAppBar: false, + body: NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: + (BuildContext context, ScrollController scrollController) { + return Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + 'Add Procedure', + fontWeight: FontWeight.w700, + fontSize: 20, + ), + InkWell( + child: Icon( + Icons.close, + size: 24.0, + ), + onTap: () { + Navigator.pop(context); + }, + ) + ]), + SizedBox( + height: MediaQuery.of(context).size.height * 0.04, + ), + Expanded( + child: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight( + MediaQuery.of(context).size.height * 0.070), + child: Container( + height: + MediaQuery.of(context).size.height * 0.070, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.5), //width: 0.7 + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorColor: Colors.transparent, + indicatorWeight: 1.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only( + top: 0, left: 0, right: 0, bottom: 0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + tabWidget( + screenSize, + _activeTab == 0, + 'All Procedures', + ), + tabWidget( + screenSize, + _activeTab == 1, + "Favorite Templates", + ), + ], + ), + ), + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + AddSelectedProcedure( + model: model, + patient: patient, + ), + AddFavouriteProcedure( + patient: patient, + model: model, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + }), + ), + ), + ); + } + + Widget tabWidget(Size screenSize, bool isActive, String title, + {int counter = -1}) { + return Center( + child: Container( + height: screenSize.height * 0.070, + decoration: TextFieldsUtils.containerBorderDecoration( + isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, + borderWidth: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 1.5, + color: isActive ? Colors.white : Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + if (counter != -1) + Container( + margin: EdgeInsets.all(4), + width: 15, + height: 15, + decoration: BoxDecoration( + color: isActive ? Colors.white : Color(0xFFD02127), + shape: BoxShape.circle, + ), + child: Center( + child: FittedBox( + child: AppText( + "$counter", + fontSize: SizeConfig.textMultiplier * 1.5, + color: !isActive ? Colors.white : Color(0xFFD02127), + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/procedures/entity_list_fav_procedure.dart b/lib/screens/procedures/entity_list_fav_procedure.dart new file mode 100644 index 00000000..31b2a784 --- /dev/null +++ b/lib/screens/procedures/entity_list_fav_procedure.dart @@ -0,0 +1,256 @@ +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget { + final ProcedureViewModel model; + final Function addSelectedHistories; + final Function(ProcedureTempleteModel) removeHistory; + final Function(ProcedureTempleteModel) addHistory; + final Function(ProcedureTempleteModel) addRemarks; + + final Function(ProcedureTempleteDetailsModel) removeFavProcedure; + final Function(ProcedureTempleteDetailsModel) addFavProcedure; + final Function(ProcedureTempleteDetailsModel) addProceduresRemarks; + + final bool Function(ProcedureTempleteModel) isEntityListSelected; + final bool Function(ProcedureTempleteDetailsModel) isEntityFavListSelected; + final List masterList; + + EntityListCheckboxSearchFavProceduresWidget( + {Key key, + this.model, + this.addSelectedHistories, + this.removeHistory, + this.masterList, + this.addHistory, + this.addFavProcedure, + this.addProceduresRemarks, + this.removeFavProcedure, + this.isEntityListSelected, + this.isEntityFavListSelected, + this.addRemarks}) + : super(key: key); + + @override + _EntityListCheckboxSearchFavProceduresWidgetState createState() => + _EntityListCheckboxSearchFavProceduresWidgetState(); +} + +class _EntityListCheckboxSearchFavProceduresWidgetState + extends State { + int selectedType = 0; + int typeUrgent; + int typeRegular; + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + List items = List(); + List itemsProcedure = List(); + List remarksList = List(); + List typeList = List(); + + @override + void initState() { + items.addAll(widget.masterList); + super.initState(); + } + + TextEditingController remarksController = TextEditingController(); + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + NetworkBaseView( + baseViewModel: widget.model, + child: Container( + height: MediaQuery.of(context).size.height * 0.65, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.white), + child: ListView( + children: [ + TextFields( + hintText: 'Search Favourite templates', + suffixIcon: EvaIcons.search, + suffixIconColor: Color(0xff2B353E), + onChanged: (value) { + filterSearchResults(value); + }, + hasBorder: false, + ), + SizedBox( + height: 15, + ), + items.length != 0 + ? Column( + children: items.map((historyInfo) { + return Column( + children: [ + ExpansionTile( + title: InkWell( + onTap: () { + widget.model + .getProcedureTemplateDetails( + templateId: + historyInfo.templateID); + }, + child: Row( + children: [ + Icon( + Icons.folder, + size: 20, + color: Color(0xff575757), + ), + Expanded( + child: Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 0), + child: AppText( + "Procedures for " + + historyInfo.templateName, + fontSize: 16.0, + variant: "bodyText", + bold: true, + color: Color(0xff575757)), + ), + ), + ], + ), + ), + children: [ + Column( + children: widget + .model.procedureTemplateDetails + .map((itemProcedure) { + return Container( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 12), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Padding( + padding: + const EdgeInsets + .symmetric( + horizontal: 11), + child: Checkbox( + value: widget + .isEntityFavListSelected( + itemProcedure), + activeColor: Color( + 0xffD02127), + onChanged: (bool + newValue) { + setState(() { + if (widget + .isEntityFavListSelected( + itemProcedure)) { + widget.removeFavProcedure( + itemProcedure); + } else { + widget.addFavProcedure( + itemProcedure); + } + }); + }), + ), + Expanded( + child: Padding( + padding: + const EdgeInsets + .symmetric( + horizontal: + 10, + vertical: 0), + child: AppText( + itemProcedure + .procedureName, + fontSize: 14.0, + variant: + "bodyText", + bold: true, + color: Color( + 0xff575757)), + ), + ), + ], + ), + ], + ), + ), + ); + }).toList(), + ), + SizedBox( + height: 2.0, + ), + DividerWithSpacesAround(), + ], + ), + ], + ); + }).toList(), + ) + : Center( + child: Container( + child: AppText("Sorry , No Match", + color: Color(0xFFB9382C)), + ), + ) + ], + ), + )), + ), + ), + ], + ), + ); + } + + void filterSearchResults(String query) { + List dummySearchList = List(); + dummySearchList.addAll(widget.masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if (item.templateName.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + setState(() { + items.clear(); + items.addAll(dummyListData); + }); + return; + } else { + setState(() { + items.clear(); + items.addAll(widget.masterList); + }); + } + } +} diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 7e18055d..b964392e 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart'; +import 'package:doctor_app_flutter/screens/procedures/add_procedure_homeScreen.dart'; import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -104,7 +105,7 @@ class ProcedureScreen extends StatelessWidget { Navigator.push( context, MaterialPageRoute( - builder: (context) => AddSelectedProcedure( + builder: (context) => AddProcedureHome( patient: patient, model: model, )), diff --git a/pubspec.lock b/pubspec.lock index 980a4154..613c2753 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -587,7 +587,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.2" + version: "0.6.3-nullsafety.1" json_annotation: dependency: transitive description: @@ -629,7 +629,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.4" mime: dependency: transitive description: @@ -921,7 +921,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0-nullsafety.2" sticky_headers: dependency: "direct main" description: @@ -1119,5 +1119,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <2.11.0" + dart: ">=2.10.0 <=2.11.0-213.1.beta" flutter: ">=1.22.0 <2.0.0"