Merge branch 'procedures_refactoring' into 'add_doctor_id'
Procedures refactoring See merge request Cloud_Solution/doctor_app_flutter!994merge-requests/997/head
commit
6c1425ad5a
@ -1,224 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,220 @@
|
||||
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: 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
|
||||
? 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 model.preparePostProcedure(
|
||||
orderType: selectedType.toString(),
|
||||
entityList: entityList,
|
||||
patient: patient,
|
||||
remarks: remarksController.text,
|
||||
procedureType: ProcedureType.PROCEDURE,
|
||||
isLocalBusy: true,
|
||||
);
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
}
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,220 @@
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
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);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,258 +0,0 @@
|
||||
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);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
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)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,279 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,247 @@
|
||||
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