Compare commits
No commits in common. 'development' and 'hot_fix' have entirely different histories.
developmen
...
hot_fix
@ -1,25 +0,0 @@
|
|||||||
class DoctorErSignAssessmentReqModel {
|
|
||||||
String setupID;
|
|
||||||
int signInType;
|
|
||||||
int loginDoctorID;
|
|
||||||
int patientID;
|
|
||||||
|
|
||||||
DoctorErSignAssessmentReqModel(
|
|
||||||
{this.setupID, this.signInType, this.loginDoctorID, this.patientID});
|
|
||||||
|
|
||||||
DoctorErSignAssessmentReqModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
setupID = json['SetupID'];
|
|
||||||
signInType = json['SignInType'];
|
|
||||||
loginDoctorID = json['LoginDoctorID'];
|
|
||||||
patientID = json['PatientID'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
||||||
data['SetupID'] = this.setupID;
|
|
||||||
data['SignInType'] = this.signInType;
|
|
||||||
data['LoginDoctorID'] = this.loginDoctorID;
|
|
||||||
data['PatientID'] = this.patientID;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_request_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_req_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/prescriptions_order.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/request_get_list_pharmacy_for_prescriptions.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription_report.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription_report_enh.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/calculate_box_request_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/search_drug/item_by_medicine_request_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/search_drug/search_drug_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/search_drug/search_drug_request_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/service/base/lookup-service.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-data.dart';
|
|
||||||
import 'package:doctor_app_flutter/utils/date-utils.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
|
|
||||||
class ERSignInService extends LookupService {
|
|
||||||
|
|
||||||
|
|
||||||
Future signInERPatient({DoctorErSignAssessmentReqModel doctorErSignAssessmentReqModel}) async {
|
|
||||||
|
|
||||||
|
|
||||||
hasError = false;
|
|
||||||
|
|
||||||
await baseAppClient.post(DOCTOR_ER_SIGN_ASSESSMENT,
|
|
||||||
onSuccess: (dynamic response, int statusCode) {
|
|
||||||
|
|
||||||
}, onFailure: (String error, int statusCode) {
|
|
||||||
hasError = true;
|
|
||||||
super.error = error;
|
|
||||||
}, body: doctorErSignAssessmentReqModel.toJson());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/core/enum/filter_type.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/enum/view_state.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-data.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/service/patient_medical_file/ER_signin/ER_signin_service.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/locator.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
|
|
||||||
class ERSignInViewModel extends BaseViewModel {
|
|
||||||
bool hasError = false;
|
|
||||||
|
|
||||||
ERSignInService _ERSignInService = locator<ERSignInService>();
|
|
||||||
|
|
||||||
Future signInERPatient({int patientId, int signInType}) async {
|
|
||||||
hasError = false;
|
|
||||||
await getDoctorProfile();
|
|
||||||
DoctorErSignAssessmentReqModel doctorErSignAssessmentReqModel = new DoctorErSignAssessmentReqModel(setupID:"010266", signInType:signInType, loginDoctorID:doctorProfile.doctorID, patientID: patientId );
|
|
||||||
setState(ViewState.BusyLocal);
|
|
||||||
await _ERSignInService.signInERPatient(doctorErSignAssessmentReqModel: doctorErSignAssessmentReqModel);
|
|
||||||
if (_ERSignInService.hasError) {
|
|
||||||
error = _ERSignInService.error;
|
|
||||||
setState(ViewState.ErrorLocal);
|
|
||||||
} else
|
|
||||||
setState(ViewState.Idle);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,227 +0,0 @@
|
|||||||
import 'package:barcode_scan2/barcode_scan2.dart';
|
|
||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/enum/view_state.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/service/AnalyticsService.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/locator.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
|
|
||||||
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
|
|
||||||
import 'package:doctor_app_flutter/utils/utils.dart';
|
|
||||||
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.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/buttons/app_buttons_widget.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
import '../../routes.dart';
|
|
||||||
import '../base/base_view.dart';
|
|
||||||
|
|
||||||
Utils helpers = Utils();
|
|
||||||
|
|
||||||
class ErSignInScreen extends StatefulWidget {
|
|
||||||
@override
|
|
||||||
_ErSignInScreenState createState() => _ErSignInScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ErSignInScreenState extends State<ErSignInScreen> {
|
|
||||||
ProjectViewModel projectViewModel;
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
projectViewModel = Provider.of(context);
|
|
||||||
|
|
||||||
return BaseView<ERSignInViewModel>(
|
|
||||||
builder: (_, model, w) => AppScaffold(
|
|
||||||
baseViewModel: model,
|
|
||||||
isShowAppBar: true,
|
|
||||||
appBar: PatientSearchHeader(title: "ER Sign In",)
|
|
||||||
,
|
|
||||||
body: Center(
|
|
||||||
child: Container(
|
|
||||||
margin: EdgeInsets.only(top: SizeConfig.realScreenHeight / 7),
|
|
||||||
child: FractionallySizedBox(
|
|
||||||
widthFactor: 0.9,
|
|
||||||
child: ListView(
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
TranslationBase.of(context).startScanning,
|
|
||||||
fontSize: 18,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 7,
|
|
||||||
),
|
|
||||||
AppText(TranslationBase.of(context).scanERQrCode,
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
textAlign: TextAlign.center),
|
|
||||||
SizedBox(
|
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
height: 150,
|
|
||||||
child: Image.asset('assets/images/qr_code.png'),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 35,
|
|
||||||
),
|
|
||||||
AppButton(
|
|
||||||
title: TranslationBase.of(context).scanQr,
|
|
||||||
onPressed: () async {
|
|
||||||
await locator<AnalyticsService>().logEvent(
|
|
||||||
eventCategory: "ErSigninScreen",
|
|
||||||
eventAction: "Scan QR",
|
|
||||||
);
|
|
||||||
_scanQrAndGetPatient(context, model);
|
|
||||||
},
|
|
||||||
icon: Image.asset('assets/images/qr_code_white.png'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
_scanQrAndGetPatient(BuildContext context, ERSignInViewModel model) async {
|
|
||||||
var result = (await BarcodeScanner.scan()).rawContent;
|
|
||||||
if (result != "") {
|
|
||||||
try{
|
|
||||||
List<String> listOfParams = result.split(',');
|
|
||||||
int patientID = 0;
|
|
||||||
if (listOfParams[0].length != 0)
|
|
||||||
patientID = int.parse(listOfParams[0]);
|
|
||||||
showMyDialog(context:context, firstAction: (){
|
|
||||||
signInERPatient(context: context, model: model, patientId: patientID, signInType: 1);
|
|
||||||
} , secondAction: (){
|
|
||||||
signInERPatient(context: context, model: model, patientId: patientID, signInType: 2);
|
|
||||||
|
|
||||||
} );
|
|
||||||
}catch(e){
|
|
||||||
Utils.showErrorToast("Please Enter Valid Code");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
signInERPatient ({BuildContext context, ERSignInViewModel model, patientId, signInType}) async {
|
|
||||||
GifLoaderDialogUtils.showMyDialog(context);
|
|
||||||
await model.signInERPatient(patientId:patientId, signInType: signInType );
|
|
||||||
if(model.state == ViewState.ErrorLocal) {
|
|
||||||
Utils.showErrorToast(model.error);
|
|
||||||
} else {
|
|
||||||
/// TODO Elham* Create this in Utils
|
|
||||||
DrAppToastMsg.showSuccesToast("Add successfully");
|
|
||||||
}
|
|
||||||
GifLoaderDialogUtils.hideDialog(context);
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// TODO Elham* Make this as custom Dialog
|
|
||||||
showMyDialog({BuildContext context, Function firstAction,Function secondAction, }) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (ctx) => Center(
|
|
||||||
child: Container(
|
|
||||||
width: MediaQuery.of(context).size.width * 0.8,
|
|
||||||
height: 250,
|
|
||||||
child: AppScaffold(
|
|
||||||
isShowAppBar: false,
|
|
||||||
body: Container(
|
|
||||||
color: Colors.white,
|
|
||||||
child: Center(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
// SizedBox(height: 20,),
|
|
||||||
SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
"Select option",
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 16,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
DividerWithSpacesAround(),
|
|
||||||
SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.all(20),
|
|
||||||
color: Colors.white,
|
|
||||||
child: AppText(
|
|
||||||
projectViewModel.isArabic
|
|
||||||
? "الرجاء اختيار الإجراء الذي تريد القيام به"
|
|
||||||
: 'Please choose the action you want to do ',
|
|
||||||
fontSize: 15,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
DividerWithSpacesAround(),
|
|
||||||
FractionallySizedBox(
|
|
||||||
widthFactor: 0.75,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
FlatButton(
|
|
||||||
child: AppText(
|
|
||||||
"Sing In",
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 16,
|
|
||||||
), //Text("Cancel"),
|
|
||||||
onPressed: () async {
|
|
||||||
await firstAction();
|
|
||||||
|
|
||||||
|
|
||||||
}),
|
|
||||||
FlatButton(
|
|
||||||
child: AppText(
|
|
||||||
"Sing Out",
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 16,
|
|
||||||
), //Text("Confirm", ),
|
|
||||||
onPressed: () async {
|
|
||||||
await secondAction();
|
|
||||||
})
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -0,0 +1,224 @@
|
|||||||
|
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/viewModel/procedure_View_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||||
|
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
|
||||||
|
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.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/buttons/app_buttons_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../config/config.dart';
|
||||||
|
import 'ProcedureType.dart';
|
||||||
|
import 'entity_list_checkbox_search_widget.dart';
|
||||||
|
|
||||||
|
class AddProcedurePage extends StatefulWidget {
|
||||||
|
final ProcedureViewModel model;
|
||||||
|
final PatiantInformtion patient;
|
||||||
|
final ProcedureType procedureType;
|
||||||
|
|
||||||
|
const AddProcedurePage(
|
||||||
|
{Key key, this.model, this.patient, @required this.procedureType})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AddProcedurePageState createState() => _AddProcedurePageState(
|
||||||
|
patient: patient, model: model, procedureType: this.procedureType);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddProcedurePageState extends State<AddProcedurePage> {
|
||||||
|
int selectedType;
|
||||||
|
ProcedureViewModel model;
|
||||||
|
PatiantInformtion patient;
|
||||||
|
ProcedureType procedureType;
|
||||||
|
|
||||||
|
_AddProcedurePageState({this.patient, this.model, this.procedureType});
|
||||||
|
|
||||||
|
TextEditingController procedureController = TextEditingController();
|
||||||
|
TextEditingController remarksController = TextEditingController();
|
||||||
|
List<EntityList> entityList = List();
|
||||||
|
List<EntityList> entityListProcedure = List();
|
||||||
|
TextEditingController procedureName = TextEditingController();
|
||||||
|
|
||||||
|
dynamic selectedCategory;
|
||||||
|
|
||||||
|
setSelectedType(int val) {
|
||||||
|
setState(() {
|
||||||
|
selectedType = val;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<ProcedureViewModel>(
|
||||||
|
onModelReady: (model) {
|
||||||
|
model.getProcedureCategory(
|
||||||
|
categoryName: procedureType.getCategoryName(),
|
||||||
|
categoryID: procedureType.getCategoryId(),
|
||||||
|
patientId: patient.patientId);
|
||||||
|
},
|
||||||
|
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
||||||
|
AppScaffold(
|
||||||
|
isShowAppBar: false,
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.070,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(12.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
if (procedureType == ProcedureType.PROCEDURE)
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.pleaseEnterProcedure,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height:
|
||||||
|
MediaQuery.of(context).size.height * 0.02,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width *
|
||||||
|
0.79,
|
||||||
|
child: AppTextFieldCustom(
|
||||||
|
hintText: TranslationBase.of(context)
|
||||||
|
.searchProcedureHere,
|
||||||
|
isTextFieldHasSuffix: false,
|
||||||
|
maxLines: 1,
|
||||||
|
minLines: 1,
|
||||||
|
hasBorder: true,
|
||||||
|
controller: procedureName,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width *
|
||||||
|
0.02,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
if (procedureName.text.isNotEmpty &&
|
||||||
|
procedureName.text.length >= 3)
|
||||||
|
model.getProcedureCategory(
|
||||||
|
patientId: patient.patientId,
|
||||||
|
categoryName:
|
||||||
|
procedureName.text);
|
||||||
|
else
|
||||||
|
DrAppToastMsg.showErrorToast(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.atLeastThreeCharacters,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
|
Icons.search,
|
||||||
|
size: 25.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if ((procedureType == ProcedureType.PROCEDURE
|
||||||
|
? procedureName.text.isNotEmpty
|
||||||
|
: true) &&
|
||||||
|
model.categoriesList.length != 0)
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: EntityListCheckboxSearchWidget(
|
||||||
|
model: widget.model,
|
||||||
|
masterList:
|
||||||
|
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),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
||||||
|
child: Wrap(
|
||||||
|
alignment: WrapAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
AppButton(
|
||||||
|
title: procedureType.getAddButtonTitle(context),
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: AppGlobal.appGreenColor,
|
||||||
|
onPressed: () async {
|
||||||
|
if (entityList.isEmpty == true) {
|
||||||
|
DrAppToastMsg.showErrorToast(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.fillTheMandatoryProcedureDetails,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.model.preparePostProcedure(
|
||||||
|
orderType: selectedType.toString(),
|
||||||
|
entityList: entityList,
|
||||||
|
patient: patient,
|
||||||
|
remarks: remarksController.text);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///TODO Elham* move it to view model
|
||||||
|
bool isEntityListSelected(EntityList masterKey) {
|
||||||
|
Iterable<EntityList> history = entityList
|
||||||
|
.where((element) => masterKey.procedureId == element.procedureId);
|
||||||
|
if (history.length > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,225 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/core/enum/view_state.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart';
|
|
||||||
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
|
|
||||||
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.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/loader/gif_loader_dialog_utils.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'entity_list_checkbox_search_widget.dart';
|
|
||||||
|
|
||||||
class AddProcedurePage extends StatefulWidget {
|
|
||||||
final ProcedureViewModel model;
|
|
||||||
final PatiantInformtion patient;
|
|
||||||
final ProcedureType procedureType;
|
|
||||||
|
|
||||||
const AddProcedurePage(
|
|
||||||
{Key key, this.model, this.patient, @required this.procedureType})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_AddProcedurePageState createState() => _AddProcedurePageState(
|
|
||||||
patient: patient, model: model, procedureType: this.procedureType);
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddProcedurePageState extends State<AddProcedurePage> {
|
|
||||||
int selectedType;
|
|
||||||
ProcedureViewModel model;
|
|
||||||
PatiantInformtion patient;
|
|
||||||
ProcedureType procedureType;
|
|
||||||
|
|
||||||
_AddProcedurePageState({this.patient, this.model, this.procedureType});
|
|
||||||
|
|
||||||
TextEditingController procedureController = TextEditingController();
|
|
||||||
TextEditingController remarksController = TextEditingController();
|
|
||||||
List<EntityList> entityList = List();
|
|
||||||
List<EntityList> entityListProcedure = List();
|
|
||||||
TextEditingController procedureName = TextEditingController();
|
|
||||||
|
|
||||||
dynamic selectedCategory;
|
|
||||||
|
|
||||||
setSelectedType(int val) {
|
|
||||||
setState(() {
|
|
||||||
selectedType = val;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return BaseView<ProcedureViewModel>(
|
|
||||||
onModelReady: (model) {
|
|
||||||
model.getProcedureCategory(
|
|
||||||
categoryName: procedureType.getCategoryName(),
|
|
||||||
categoryID: procedureType.getCategoryId(),
|
|
||||||
patientId: patient.patientId);
|
|
||||||
},
|
|
||||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
|
||||||
AppScaffold(
|
|
||||||
isShowAppBar: false,
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
child: FractionallySizedBox(
|
|
||||||
widthFactor: .97,
|
|
||||||
child: Center(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
height: MediaQuery.of(context).size.height * 0.070,
|
|
||||||
),
|
|
||||||
NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: Container(
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(12.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
if (procedureType == ProcedureType.PROCEDURE)
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
TranslationBase.of(context)
|
|
||||||
.pleaseEnterProcedure,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 20,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height:
|
|
||||||
MediaQuery.of(context).size.height * 0.02,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: MediaQuery.of(context).size.width *
|
|
||||||
0.79,
|
|
||||||
child: AppTextFieldCustom(
|
|
||||||
hintText: TranslationBase.of(context)
|
|
||||||
.searchProcedureHere,
|
|
||||||
isTextFieldHasSuffix: false,
|
|
||||||
maxLines: 1,
|
|
||||||
minLines: 1,
|
|
||||||
hasBorder: true,
|
|
||||||
controller: procedureName,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: MediaQuery.of(context).size.width *
|
|
||||||
0.02,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () async {
|
|
||||||
if (procedureName.text.isNotEmpty &&
|
|
||||||
procedureName.text.length >= 3) {
|
|
||||||
GifLoaderDialogUtils.showMyDialog(
|
|
||||||
context);
|
|
||||||
await model.getProcedureCategory(
|
|
||||||
patientId: patient.patientId,
|
|
||||||
categoryName: procedureName.text,
|
|
||||||
isLocalBusy: true);
|
|
||||||
if (model.state ==
|
|
||||||
ViewState.ErrorLocal) {
|
|
||||||
DrAppToastMsg.showErrorToast(
|
|
||||||
model.error);
|
|
||||||
}
|
|
||||||
GifLoaderDialogUtils.hideDialog(
|
|
||||||
context);
|
|
||||||
} else {
|
|
||||||
DrAppToastMsg.showErrorToast(
|
|
||||||
TranslationBase.of(context)
|
|
||||||
.atLeastThreeCharacters,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Icon(
|
|
||||||
Icons.search,
|
|
||||||
size: 25.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
if ((procedureType == ProcedureType.PROCEDURE
|
|
||||||
? procedureName.text.isNotEmpty
|
|
||||||
: true) &&
|
|
||||||
model.categoriesList.length != 0)
|
|
||||||
NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: EntityListCheckboxSearchWidget(
|
|
||||||
model: widget.model,
|
|
||||||
masterList: model.categoriesList[0].entityList,
|
|
||||||
removeProcedure: (item) {
|
|
||||||
setState(() {
|
|
||||||
entityList.remove(item);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addProcedure: (history) {
|
|
||||||
setState(() {
|
|
||||||
entityList.add(history);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addSelectedHistories: () {},
|
|
||||||
isEntityListSelected: (master) => widget.model
|
|
||||||
.isEntityListSelected(master, entityList),
|
|
||||||
)),
|
|
||||||
SizedBox(
|
|
||||||
height: 10,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
bottomSheet: model.state == ViewState.BusyLocal || entityList.isEmpty
|
|
||||||
? Container(
|
|
||||||
height: 0,
|
|
||||||
)
|
|
||||||
: CustomBottomSheetContainer(
|
|
||||||
label: procedureType.getAddButtonTitle(context),
|
|
||||||
onTap: () async {
|
|
||||||
{
|
|
||||||
GifLoaderDialogUtils.showMyDialog(context);
|
|
||||||
if (entityList.isEmpty == true) {
|
|
||||||
DrAppToastMsg.showErrorToast(
|
|
||||||
TranslationBase.of(context)
|
|
||||||
.fillTheMandatoryProcedureDetails,
|
|
||||||
);
|
|
||||||
GifLoaderDialogUtils.hideDialog(context);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
GifLoaderDialogUtils.showMyDialog(context);
|
|
||||||
await widget.model.preparePostProcedure(
|
|
||||||
orderType: selectedType.toString(),
|
|
||||||
entityList: entityList,
|
|
||||||
patient: patient,
|
|
||||||
remarks: remarksController.text,
|
|
||||||
procedureType: ProcedureType.PROCEDURE,
|
|
||||||
isLocalBusy: true,
|
|
||||||
);
|
|
||||||
GifLoaderDialogUtils.hideDialog(context);
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,221 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.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/screens/base/base_view.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
|
|
||||||
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
|
||||||
import 'package:doctor_app_flutter/utils/utils.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/buttons/app_buttons_widget.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import '../../../config/config.dart';
|
|
||||||
|
|
||||||
class ProcedureCheckOutScreen extends StatefulWidget {
|
|
||||||
final List<ProcedureTempleteDetailsModel> items;
|
|
||||||
final ProcedureViewModel previousProcedureViewModel;
|
|
||||||
final PatiantInformtion patient;
|
|
||||||
final String addButtonTitle;
|
|
||||||
final String toolbarTitle;
|
|
||||||
|
|
||||||
ProcedureCheckOutScreen(
|
|
||||||
{this.items,
|
|
||||||
this.previousProcedureViewModel,
|
|
||||||
this.patient,
|
|
||||||
@required this.addButtonTitle,
|
|
||||||
@required this.toolbarTitle});
|
|
||||||
|
|
||||||
@override
|
|
||||||
_ProcedureCheckOutScreenState createState() =>
|
|
||||||
_ProcedureCheckOutScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
|
|
||||||
List<String> remarksList = List();
|
|
||||||
final TextEditingController remarksController = TextEditingController();
|
|
||||||
List<int> typeList = List();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return BaseView<ProcedureViewModel>(
|
|
||||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
|
||||||
AppScaffold(
|
|
||||||
backgroundColor: Color(0xffF8F8F8).withOpacity(0.9),
|
|
||||||
isShowAppBar: true,
|
|
||||||
appBar: PatientSearchHeader(
|
|
||||||
title: widget.toolbarTitle ?? 'Add Procedure',
|
|
||||||
),
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
child: Center(
|
|
||||||
child: FractionallySizedBox(
|
|
||||||
widthFactor: 0.95,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: 30,
|
|
||||||
),
|
|
||||||
ListView.builder(
|
|
||||||
scrollDirection: Axis.vertical,
|
|
||||||
itemCount: widget.items.length,
|
|
||||||
physics: BouncingScrollPhysics(),
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemBuilder: (BuildContext ctxt, int index) {
|
|
||||||
final TextEditingController remarksControllerNew =
|
|
||||||
TextEditingController(
|
|
||||||
text: widget.items[index].remarks);
|
|
||||||
|
|
||||||
return Container(
|
|
||||||
margin: EdgeInsets.only(bottom: 15.0),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.all(Radius.circular(10.0))),
|
|
||||||
child: ExpansionTile(
|
|
||||||
initiallyExpanded: true,
|
|
||||||
title: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: AppText(
|
|
||||||
Utils.convertToTitleCase(
|
|
||||||
widget.items[index].procedureName),
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: AppGlobal.appTextColor,
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment:
|
|
||||||
CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 11),
|
|
||||||
child: AppText(
|
|
||||||
TranslationBase.of(context)
|
|
||||||
.orderType,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: Color(0xff2B353E),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Radio(
|
|
||||||
activeColor: Color(0xFFD02127),
|
|
||||||
value: 0,
|
|
||||||
groupValue: widget
|
|
||||||
.items[index].selectedType,
|
|
||||||
onChanged: (value) {
|
|
||||||
widget.items[index].selectedType =
|
|
||||||
0;
|
|
||||||
setState(() {
|
|
||||||
widget.items[index].type =
|
|
||||||
value.toString();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
AppText(
|
|
||||||
'routine',
|
|
||||||
color: Color(0xff575757),
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
Radio(
|
|
||||||
activeColor: Color(0xFFD02127),
|
|
||||||
groupValue: widget
|
|
||||||
.items[index].selectedType,
|
|
||||||
value: 1,
|
|
||||||
onChanged: (value) {
|
|
||||||
widget.items[index].selectedType =
|
|
||||||
1;
|
|
||||||
setState(() {
|
|
||||||
widget.items[index].type =
|
|
||||||
value.toString();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
AppText(
|
|
||||||
TranslationBase.of(context).urgent,
|
|
||||||
color: Color(0xff575757),
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 2.0,
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
horizontal: 12, vertical: 15.0),
|
|
||||||
child: TextFields(
|
|
||||||
hintText: TranslationBase.of(context).remarks,
|
|
||||||
controller: remarksControllerNew,
|
|
||||||
onChanged: (value) {
|
|
||||||
widget.items[index].remarks = value;
|
|
||||||
},
|
|
||||||
minLines: 3,
|
|
||||||
maxLines: 5,
|
|
||||||
borderWidth: 0.5,
|
|
||||||
borderColor: Colors.grey[500],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 19.0,
|
|
||||||
),
|
|
||||||
//DividerWithSpacesAround(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
SizedBox(
|
|
||||||
height: 90,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
///TODO Elham* use our custom bottomsheet
|
|
||||||
bottomSheet: Container(
|
|
||||||
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
||||||
child: Wrap(
|
|
||||||
alignment: WrapAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
AppButton(
|
|
||||||
title: widget.addButtonTitle ??
|
|
||||||
TranslationBase.of(context).addSelectedProcedures,
|
|
||||||
color: AppGlobal.appGreenColor,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
onPressed: () async {
|
|
||||||
GifLoaderDialogUtils.showMyDialog(context);
|
|
||||||
await widget.previousProcedureViewModel.addProcedures(
|
|
||||||
widget.previousProcedureViewModel,
|
|
||||||
widget.items,
|
|
||||||
widget.patient,
|
|
||||||
remarksController,
|
|
||||||
isLocalBusy: true);
|
|
||||||
GifLoaderDialogUtils.hideDialog(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,258 @@
|
|||||||
|
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_template_details_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/service/AnalyticsService.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/locator.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||||
|
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.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/buttons/app_buttons_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../config/config.dart';
|
||||||
|
|
||||||
|
class ProcedureCheckOutScreen extends StatefulWidget {
|
||||||
|
final List<ProcedureTempleteDetailsModel> items;
|
||||||
|
final ProcedureViewModel model;
|
||||||
|
final PatiantInformtion patient;
|
||||||
|
final String addButtonTitle;
|
||||||
|
final String toolbarTitle;
|
||||||
|
|
||||||
|
ProcedureCheckOutScreen(
|
||||||
|
{this.items,
|
||||||
|
this.model,
|
||||||
|
this.patient,
|
||||||
|
@required this.addButtonTitle,
|
||||||
|
@required this.toolbarTitle});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ProcedureCheckOutScreenState createState() =>
|
||||||
|
_ProcedureCheckOutScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
|
||||||
|
List<String> remarksList = List();
|
||||||
|
final TextEditingController remarksController = TextEditingController();
|
||||||
|
List<int> typeList = List();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<ProcedureViewModel>(
|
||||||
|
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
||||||
|
AppScaffold(
|
||||||
|
backgroundColor: Color(0xffF8F8F8).withOpacity(0.9),
|
||||||
|
isShowAppBar: false,
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.070,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(12.0),
|
||||||
|
child: Row(
|
||||||
|
//mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
child: Icon(
|
||||||
|
Icons.arrow_back_ios_sharp,
|
||||||
|
size: 24.0,
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 5.0,
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
widget.toolbarTitle ?? 'Add Procedure',
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
|
||||||
|
///TODO Elham* user view list builder
|
||||||
|
|
||||||
|
...List.generate(
|
||||||
|
widget.items.length,
|
||||||
|
(index) => Container(
|
||||||
|
margin: EdgeInsets.only(bottom: 15.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(10.0))),
|
||||||
|
child: ExpansionTile(
|
||||||
|
initiallyExpanded: true,
|
||||||
|
title: Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.check_box,
|
||||||
|
color: Color(0xffD02127),
|
||||||
|
size: 30.5,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 6.0,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: AppText(
|
||||||
|
widget.items[index].procedureName)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 11),
|
||||||
|
child: AppText(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.orderType,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Radio(
|
||||||
|
activeColor: Color(0xFFD02127),
|
||||||
|
value: 0,
|
||||||
|
groupValue:
|
||||||
|
widget.items[index].selectedType,
|
||||||
|
onChanged: (value) {
|
||||||
|
widget.items[index].selectedType =
|
||||||
|
0;
|
||||||
|
setState(() {
|
||||||
|
widget.items[index].type =
|
||||||
|
value.toString();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
'routine',
|
||||||
|
color: Color(0xff575757),
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
Radio(
|
||||||
|
activeColor: Color(0xFFD02127),
|
||||||
|
groupValue:
|
||||||
|
widget.items[index].selectedType,
|
||||||
|
value: 1,
|
||||||
|
onChanged: (value) {
|
||||||
|
widget.items[index].selectedType =
|
||||||
|
1;
|
||||||
|
setState(() {
|
||||||
|
widget.items[index].type =
|
||||||
|
value.toString();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
TranslationBase.of(context).urgent,
|
||||||
|
color: Color(0xff575757),
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 2.0,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 12, vertical: 15.0),
|
||||||
|
child: TextFields(
|
||||||
|
hintText: TranslationBase.of(context).remarks,
|
||||||
|
controller: remarksController,
|
||||||
|
onChanged: (value) {
|
||||||
|
widget.items[index].remarks = value;
|
||||||
|
},
|
||||||
|
minLines: 3,
|
||||||
|
maxLines: 5,
|
||||||
|
borderWidth: 0.5,
|
||||||
|
borderColor: Colors.grey[500],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 19.0,
|
||||||
|
),
|
||||||
|
//DividerWithSpacesAround(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
height: 90,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: Container(
|
||||||
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
||||||
|
child: Wrap(
|
||||||
|
alignment: WrapAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
AppButton(
|
||||||
|
title: widget.addButtonTitle ??
|
||||||
|
TranslationBase.of(context).addSelectedProcedures,
|
||||||
|
color: AppGlobal.appGreenColor,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
onPressed: () async {
|
||||||
|
|
||||||
|
///TODO Elham* move it to function
|
||||||
|
|
||||||
|
List<EntityList> entityList = List();
|
||||||
|
widget.items.forEach((element) {
|
||||||
|
entityList.add(
|
||||||
|
EntityList(
|
||||||
|
procedureId: element.procedureID,
|
||||||
|
remarks: element.remarks,
|
||||||
|
categoryID: element.categoryID,
|
||||||
|
type: element.type,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
await locator<AnalyticsService>().logEvent(
|
||||||
|
eventCategory: "Procedure Checkout Screen",
|
||||||
|
eventAction: "Add New Procedure",
|
||||||
|
);
|
||||||
|
Navigator.pop(context);
|
||||||
|
await model.preparePostProcedure(
|
||||||
|
entityList: entityList,
|
||||||
|
patient: widget.patient,
|
||||||
|
remarks: remarksController.text);
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,38 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/utils/tab_utils.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
class TabWidget {
|
|
||||||
static Widget tabWidget(
|
|
||||||
Size screenSize,
|
|
||||||
bool isActive,
|
|
||||||
String title, {
|
|
||||||
int counter = -1,
|
|
||||||
bool isFirst = false,
|
|
||||||
bool isMiddle = false,
|
|
||||||
bool isLast = false,
|
|
||||||
context,
|
|
||||||
}) {
|
|
||||||
ProjectViewModel projectViewModel = Provider.of(context);
|
|
||||||
return Center(
|
|
||||||
child: Container(
|
|
||||||
height: TabUtils.getTabHeight(context),
|
|
||||||
decoration: TabUtils.getBoxTabsBoxDecoration(
|
|
||||||
isActive: isActive,
|
|
||||||
isFirst: isFirst,
|
|
||||||
isMiddle: isMiddle,
|
|
||||||
isLast: isLast,
|
|
||||||
projectViewModel: projectViewModel),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
TabUtils.getTabText(title: title, isActive: isActive),
|
|
||||||
if (counter != -1)
|
|
||||||
TabUtils.getTabCounter(isActive: isActive, counter: counter)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,279 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/config.dart';
|
||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/enum/view_state.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||||
|
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
|
||||||
|
import 'package:doctor_app_flutter/utils/utils.dart';
|
||||||
|
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_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/material.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
void updateProcedureForm(context,
|
||||||
|
{String procedureName,
|
||||||
|
int orderNo,
|
||||||
|
int limetNo,
|
||||||
|
PatiantInformtion patient,
|
||||||
|
String orderType,
|
||||||
|
String procedureId,
|
||||||
|
String remarks,
|
||||||
|
ProcedureViewModel model,
|
||||||
|
String categoreId}) {
|
||||||
|
TextEditingController remarksController = TextEditingController();
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (BuildContext bc) {
|
||||||
|
return UpdateProcedureWidget(
|
||||||
|
procedureName: procedureName,
|
||||||
|
remarks: remarks,
|
||||||
|
remarksController: remarksController,
|
||||||
|
patient: patient,
|
||||||
|
model: model,
|
||||||
|
procedureId: procedureId,
|
||||||
|
categoryId: categoreId,
|
||||||
|
orderNo: orderNo,
|
||||||
|
limetNo: limetNo,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateProcedureWidget extends StatefulWidget {
|
||||||
|
final PatiantInformtion patient;
|
||||||
|
final ProcedureViewModel model;
|
||||||
|
final String procedureName;
|
||||||
|
final String remarks;
|
||||||
|
final TextEditingController remarksController;
|
||||||
|
final String procedureId;
|
||||||
|
final String categoryId;
|
||||||
|
final int orderNo;
|
||||||
|
final int limetNo;
|
||||||
|
|
||||||
|
UpdateProcedureWidget(
|
||||||
|
{this.model,
|
||||||
|
this.procedureName,
|
||||||
|
this.remarks,
|
||||||
|
this.remarksController,
|
||||||
|
this.patient,
|
||||||
|
this.procedureId,
|
||||||
|
this.categoryId,
|
||||||
|
this.orderNo,
|
||||||
|
this.limetNo});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_UpdateProcedureWidgetState createState() => _UpdateProcedureWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
|
||||||
|
int selectedType = 0;
|
||||||
|
|
||||||
|
setSelectedType(int val) {
|
||||||
|
setState(() {
|
||||||
|
selectedType = val;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
widget.remarksController.text = widget.remarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<EntityList> entityList = List();
|
||||||
|
dynamic selectedCategory;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final screenSize = MediaQuery.of(context).size;
|
||||||
|
return StatefulBuilder(builder:
|
||||||
|
(BuildContext context, StateSetter setState /*You can rename this!*/) {
|
||||||
|
return BaseView<ProcedureViewModel>(
|
||||||
|
onModelReady: (model) => model.getCategory(),
|
||||||
|
builder:
|
||||||
|
(BuildContext context, ProcedureViewModel model, Widget child) =>
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.9,
|
||||||
|
child: Form(
|
||||||
|
child: Padding(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
widget.procedureName.toUpperCase(),
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
AppText(TranslationBase.of(context).orderType),
|
||||||
|
Radio(
|
||||||
|
activeColor: AppGlobal.appRedColor,
|
||||||
|
value: 0,
|
||||||
|
groupValue: selectedType,
|
||||||
|
onChanged: (value) {
|
||||||
|
setSelectedType(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Text('routine'),
|
||||||
|
Radio(
|
||||||
|
activeColor: AppGlobal.appRedColor,
|
||||||
|
groupValue: selectedType,
|
||||||
|
value: 1,
|
||||||
|
onChanged: (value) {
|
||||||
|
setSelectedType(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Text(TranslationBase.of(context).urgent),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(6.0)),
|
||||||
|
border: Border.all(
|
||||||
|
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||||
|
child: TextFields(
|
||||||
|
fontSize: 15.0,
|
||||||
|
controller: widget.remarksController,
|
||||||
|
hintText: widget.remarksController.text.isEmpty
|
||||||
|
? 'No Remarks Added'
|
||||||
|
: '',
|
||||||
|
maxLines: 3,
|
||||||
|
minLines: 2,
|
||||||
|
onChanged: (value) {},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.all(SizeConfig.widthMultiplier * 2),
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
AppButton(
|
||||||
|
color: AppGlobal.appGreenColor,
|
||||||
|
title: TranslationBase.of(context)
|
||||||
|
.updateProcedure
|
||||||
|
.toUpperCase(),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
updateProcedure(
|
||||||
|
limetNO: widget.limetNo,
|
||||||
|
orderNo: widget.orderNo,
|
||||||
|
orderType: selectedType.toString(),
|
||||||
|
categorieId: widget.categoryId,
|
||||||
|
procedureId: widget.procedureId,
|
||||||
|
entityList: entityList,
|
||||||
|
patient: widget.patient,
|
||||||
|
model: widget.model,
|
||||||
|
remarks: widget.remarksController.text);
|
||||||
|
// authorizationForm(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.0,
|
||||||
|
),
|
||||||
|
AppButton(
|
||||||
|
title: TranslationBase.of(context).cancel,
|
||||||
|
color: AppGlobal.appRedColor,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
updateProcedure(
|
||||||
|
{ProcedureViewModel model,
|
||||||
|
String remarks,
|
||||||
|
int limetNO,
|
||||||
|
int orderNo,
|
||||||
|
String newProcedureId,
|
||||||
|
String newCategorieId,
|
||||||
|
List<EntityList> entityList,
|
||||||
|
String orderType,
|
||||||
|
String procedureId,
|
||||||
|
PatiantInformtion patient,
|
||||||
|
String categorieId}) async {
|
||||||
|
UpdateProcedureRequestModel updateProcedureReqModel =
|
||||||
|
new UpdateProcedureRequestModel();
|
||||||
|
List<Controls> controls = List();
|
||||||
|
ProcedureDetail controlsProcedure = new ProcedureDetail();
|
||||||
|
|
||||||
|
updateProcedureReqModel.appointmentNo = patient.appointmentNo;
|
||||||
|
|
||||||
|
updateProcedureReqModel.episodeID = patient.episodeNo;
|
||||||
|
updateProcedureReqModel.patientMRN = patient.patientMRN;
|
||||||
|
updateProcedureReqModel.lineItemNo = limetNO;
|
||||||
|
updateProcedureReqModel.orderNo = orderNo;
|
||||||
|
|
||||||
|
{
|
||||||
|
controls.add(
|
||||||
|
Controls(
|
||||||
|
code: "remarks", controlValue: remarks.isNotEmpty ? remarks : ""),
|
||||||
|
);
|
||||||
|
controls.add(
|
||||||
|
Controls(code: "ordertype", controlValue: orderType),
|
||||||
|
);
|
||||||
|
|
||||||
|
controlsProcedure.procedure = procedureId;
|
||||||
|
controlsProcedure.category = '0' + categorieId;
|
||||||
|
|
||||||
|
controlsProcedure.controls = controls;
|
||||||
|
}
|
||||||
|
updateProcedureReqModel.procedureDetail = controlsProcedure;
|
||||||
|
|
||||||
|
await model.updateProcedure(
|
||||||
|
updateProcedureRequestModel: updateProcedureReqModel,
|
||||||
|
mrn: patient.patientMRN);
|
||||||
|
|
||||||
|
if (model.state == ViewState.ErrorLocal) {
|
||||||
|
Utils.showErrorToast(model.error);
|
||||||
|
model.getProcedure(mrn: patient.patientMRN);
|
||||||
|
} else if (model.state == ViewState.Idle) {
|
||||||
|
DrAppToastMsg.showSuccesToast('procedure has been updated');
|
||||||
|
model.getProcedure(mrn: patient.patientMRN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///TODO Elham* move it to view model
|
||||||
|
bool isEntityListSelected(EntityList masterKey) {
|
||||||
|
Iterable<EntityList> history = entityList
|
||||||
|
.where((element) => masterKey.procedureId == element.procedureId);
|
||||||
|
if (history.length > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,247 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/enum/view_state.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
|
|
||||||
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
|
|
||||||
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
|
||||||
import 'package:doctor_app_flutter/utils/utils.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.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/loader/gif_loader_dialog_utils.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hexcolor/hexcolor.dart';
|
|
||||||
|
|
||||||
void updateProcedureForm(context,
|
|
||||||
{String procedureName,
|
|
||||||
int orderNo,
|
|
||||||
int limetNo,
|
|
||||||
PatiantInformtion patient,
|
|
||||||
String orderType,
|
|
||||||
String procedureId,
|
|
||||||
String remarks,
|
|
||||||
ProcedureViewModel model,
|
|
||||||
String categoreId}) {
|
|
||||||
TextEditingController remarksController = TextEditingController();
|
|
||||||
showModalBottomSheet(
|
|
||||||
context: context,
|
|
||||||
isScrollControlled: true,
|
|
||||||
builder: (BuildContext bc) {
|
|
||||||
return UpdateProcedureWidget(
|
|
||||||
procedureName: procedureName,
|
|
||||||
remarks: remarks,
|
|
||||||
remarksController: remarksController,
|
|
||||||
patient: patient,
|
|
||||||
previousModel: model,
|
|
||||||
procedureId: procedureId,
|
|
||||||
categoryId: categoreId,
|
|
||||||
orderNo: orderNo,
|
|
||||||
limetNo: limetNo,
|
|
||||||
selectedType: int.parse(orderType),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class UpdateProcedureWidget extends StatefulWidget {
|
|
||||||
final PatiantInformtion patient;
|
|
||||||
final ProcedureViewModel previousModel;
|
|
||||||
final String procedureName;
|
|
||||||
final String remarks;
|
|
||||||
final TextEditingController remarksController;
|
|
||||||
final String procedureId;
|
|
||||||
final String categoryId;
|
|
||||||
final int orderNo;
|
|
||||||
final int limetNo;
|
|
||||||
int selectedType;
|
|
||||||
|
|
||||||
|
|
||||||
UpdateProcedureWidget(
|
|
||||||
{this.previousModel,
|
|
||||||
this.procedureName,
|
|
||||||
this.remarks,
|
|
||||||
this.remarksController,
|
|
||||||
this.patient,
|
|
||||||
this.procedureId,
|
|
||||||
this.categoryId,
|
|
||||||
this.orderNo,
|
|
||||||
this.limetNo, this.selectedType});
|
|
||||||
|
|
||||||
@override
|
|
||||||
_UpdateProcedureWidgetState createState() => _UpdateProcedureWidgetState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
|
|
||||||
|
|
||||||
setSelectedType(int val) {
|
|
||||||
setState(() {
|
|
||||||
widget.selectedType = val;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
widget.remarksController.text = widget.remarks;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<EntityList> entityList = List();
|
|
||||||
dynamic selectedCategory;
|
|
||||||
|
|
||||||
/// TODO Roaa Add translation and make sure it working fine
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return BaseView<ProcedureViewModel>(
|
|
||||||
onModelReady: (model) => model.getCategory(),
|
|
||||||
builder:
|
|
||||||
(BuildContext context, ProcedureViewModel _model, Widget child) =>
|
|
||||||
AppScaffold(
|
|
||||||
baseViewModel: widget.previousModel,
|
|
||||||
isShowAppBar: true,
|
|
||||||
appBar: BottomSheetTitle(title: "Update Procedure"),
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
child: Container(
|
|
||||||
height: MediaQuery.of(context).size.height * 0.9,
|
|
||||||
child: Form(
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
Utils.convertToTitleCase(widget.procedureName),
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 30.0,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
AppText(TranslationBase.of(context).orderType),
|
|
||||||
Radio(
|
|
||||||
activeColor: AppGlobal.appRedColor,
|
|
||||||
value: 0,
|
|
||||||
groupValue: widget.selectedType,
|
|
||||||
onChanged: (value) {
|
|
||||||
setSelectedType(value);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
Text('routine'),
|
|
||||||
Radio(
|
|
||||||
activeColor: AppGlobal.appRedColor,
|
|
||||||
groupValue: widget.selectedType,
|
|
||||||
value: 1,
|
|
||||||
onChanged: (value) {
|
|
||||||
setSelectedType(value);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
Text(TranslationBase.of(context).urgent),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 12.0,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.all(Radius.circular(6.0)),
|
|
||||||
border: Border.all(
|
|
||||||
width: 1.0, color: HexColor("#CCCCCC"))),
|
|
||||||
child: TextFields(
|
|
||||||
fontSize: 15.0,
|
|
||||||
controller: widget.remarksController,
|
|
||||||
hintText: widget.remarksController.text.isEmpty
|
|
||||||
? 'No Remarks Added'
|
|
||||||
: '',
|
|
||||||
maxLines: 3,
|
|
||||||
minLines: 2,
|
|
||||||
onChanged: (value) {},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 70.0,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
bottomSheet: CustomBottomSheetContainer(
|
|
||||||
label: TranslationBase.of(context).updateProcedure,
|
|
||||||
onTap: () => updateProcedure(
|
|
||||||
lineItemNo: widget.limetNo,
|
|
||||||
orderNo: widget.orderNo,
|
|
||||||
orderType: widget.selectedType.toString(),
|
|
||||||
categoryId: widget.categoryId,
|
|
||||||
procedureId: widget.procedureId,
|
|
||||||
entityList: entityList,
|
|
||||||
patient: widget.patient,
|
|
||||||
model: widget.previousModel,
|
|
||||||
remarks: widget.remarksController.text),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateProcedure(
|
|
||||||
{ProcedureViewModel model,
|
|
||||||
String remarks,
|
|
||||||
int lineItemNo,
|
|
||||||
int orderNo,
|
|
||||||
String newProcedureId,
|
|
||||||
String newCategoryId,
|
|
||||||
List<EntityList> entityList,
|
|
||||||
String orderType,
|
|
||||||
String procedureId,
|
|
||||||
PatiantInformtion patient,
|
|
||||||
String categoryId}) async {
|
|
||||||
UpdateProcedureRequestModel updateProcedureReqModel =
|
|
||||||
new UpdateProcedureRequestModel();
|
|
||||||
List<Controls> controls = List();
|
|
||||||
ProcedureDetail controlsProcedure = new ProcedureDetail();
|
|
||||||
|
|
||||||
updateProcedureReqModel.appointmentNo = patient.appointmentNo;
|
|
||||||
|
|
||||||
updateProcedureReqModel.episodeID = patient.episodeNo;
|
|
||||||
updateProcedureReqModel.patientMRN = patient.patientMRN;
|
|
||||||
updateProcedureReqModel.lineItemNo = lineItemNo;
|
|
||||||
updateProcedureReqModel.orderNo = orderNo;
|
|
||||||
|
|
||||||
{
|
|
||||||
controls.add(
|
|
||||||
Controls(
|
|
||||||
code: "remarks", controlValue: remarks.isNotEmpty ? remarks : ""),
|
|
||||||
);
|
|
||||||
controls.add(
|
|
||||||
Controls(code: "ordertype", controlValue: orderType),
|
|
||||||
);
|
|
||||||
|
|
||||||
controlsProcedure.procedure = procedureId;
|
|
||||||
controlsProcedure.category = '0' + categoryId;
|
|
||||||
|
|
||||||
controlsProcedure.controls = controls;
|
|
||||||
}
|
|
||||||
updateProcedureReqModel.procedureDetail = controlsProcedure;
|
|
||||||
GifLoaderDialogUtils.showMyDialog(context);
|
|
||||||
await widget.previousModel.updateProcedure(
|
|
||||||
updateProcedureRequestModel: updateProcedureReqModel,
|
|
||||||
mrn: patient.patientMRN, isLocalBusy: true);
|
|
||||||
|
|
||||||
if (model.state == ViewState.ErrorLocal) {
|
|
||||||
Utils.showErrorToast(model.error);
|
|
||||||
} else if (model.state == ViewState.Idle) {
|
|
||||||
DrAppToastMsg.showSuccesToast('procedure has been updated');
|
|
||||||
await widget.previousModel.getProcedure(mrn: patient.patientMRN, isLocalBusy: true);
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
|
|
||||||
}
|
|
||||||
GifLoaderDialogUtils.hideDialog(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue