favourite procedure templates
parent
3b800bcd19
commit
84a7f44b68
@ -0,0 +1,150 @@
|
||||
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
||||
import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart';
|
||||
import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class AddFavouriteProcedure extends StatefulWidget {
|
||||
final ProcedureViewModel model;
|
||||
final PatiantInformtion patient;
|
||||
|
||||
const AddFavouriteProcedure({Key key, this.model, this.patient})
|
||||
: super(key: key);
|
||||
@override
|
||||
_AddFavouriteProcedureState createState() => _AddFavouriteProcedureState();
|
||||
}
|
||||
|
||||
class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
|
||||
_AddFavouriteProcedureState({this.patient, this.model});
|
||||
ProcedureViewModel model;
|
||||
PatiantInformtion patient;
|
||||
List<ProcedureTempleteModel> entityList = List();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<ProcedureViewModel>(
|
||||
onModelReady: (model) => model.getProcedureTemplate(),
|
||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
||||
AppScaffold(
|
||||
isShowAppBar: false,
|
||||
body: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * 0.070,
|
||||
),
|
||||
if (model.procedureList.length != 0)
|
||||
NetworkBaseView(
|
||||
baseViewModel: model,
|
||||
child:
|
||||
// selectedCategory != null
|
||||
// ? selectedCategory['categoryId'] == 02 ||
|
||||
// selectedCategory['categoryId'] == 03
|
||||
// ?
|
||||
EntityListCheckboxSearchFavProceduresWidget(
|
||||
model: widget.model,
|
||||
masterList: widget.model.ProcedureTemplate,
|
||||
removeHistory: (item) {
|
||||
setState(() {
|
||||
entityList.remove(item);
|
||||
});
|
||||
},
|
||||
addHistory: (history) {
|
||||
setState(() {
|
||||
entityList.add(history);
|
||||
});
|
||||
},
|
||||
addSelectedHistories: () {
|
||||
//TODO build your fun herr
|
||||
// widget.addSelectedHistories();
|
||||
},
|
||||
isEntityListSelected: (master) =>
|
||||
isEntityListSelected(master),
|
||||
)
|
||||
// : ProcedureListWidget(
|
||||
// model: widget.model,
|
||||
// masterList: widget.model
|
||||
// .categoriesList[0].entityList,
|
||||
// removeHistory: (item) {
|
||||
// setState(() {
|
||||
// entityList.remove(item);
|
||||
// });
|
||||
// },
|
||||
// addHistory: (history) {
|
||||
// setState(() {
|
||||
// entityList.add(history);
|
||||
// });
|
||||
// },
|
||||
// addSelectedHistories: () {
|
||||
// //TODO build your fun herr
|
||||
// // widget.addSelectedHistories();
|
||||
// },
|
||||
// isEntityListSelected: (master) =>
|
||||
// isEntityListSelected(master),
|
||||
// )
|
||||
// : null,
|
||||
),
|
||||
SizedBox(
|
||||
height: 15.0,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Container(
|
||||
// child: Row(
|
||||
// children: [
|
||||
// AppText(
|
||||
// TranslationBase.of(context).orderType),
|
||||
// Radio(
|
||||
// activeColor: Color(0xFFB9382C),
|
||||
// value: 1,
|
||||
// groupValue: selectedType,
|
||||
// onChanged: (value) {
|
||||
// setSelectedType(value);
|
||||
// },
|
||||
// ),
|
||||
// Text('routine'),
|
||||
// Radio(
|
||||
// activeColor: Color(0xFFB9382C),
|
||||
// groupValue: selectedType,
|
||||
// value: 0,
|
||||
// onChanged: (value) {
|
||||
// setSelectedType(value);
|
||||
// },
|
||||
// ),
|
||||
// Text(TranslationBase.of(context).urgent),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 15.0,
|
||||
// ),
|
||||
// TextFields(
|
||||
// hintText: TranslationBase.of(context).remarks,
|
||||
// controller: remarksController,
|
||||
// minLines: 3,
|
||||
// maxLines: 5,
|
||||
// ),
|
||||
SizedBox(
|
||||
height: 100.0,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
bool isEntityListSelected(ProcedureTempleteModel masterKey) {
|
||||
Iterable<ProcedureTempleteModel> history = entityList
|
||||
.where((element) => masterKey.templateID == element.templateID);
|
||||
if (history.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,268 @@
|
||||
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
||||
import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget {
|
||||
final ProcedureViewModel model;
|
||||
final Function addSelectedHistories;
|
||||
final Function(ProcedureTempleteModel) removeHistory;
|
||||
final Function(ProcedureTempleteModel) addHistory;
|
||||
final Function(ProcedureTempleteModel) addRemarks;
|
||||
|
||||
final bool Function(ProcedureTempleteModel) isEntityListSelected;
|
||||
final List<ProcedureTempleteModel> masterList;
|
||||
|
||||
EntityListCheckboxSearchFavProceduresWidget(
|
||||
{Key key,
|
||||
this.model,
|
||||
this.addSelectedHistories,
|
||||
this.removeHistory,
|
||||
this.masterList,
|
||||
this.addHistory,
|
||||
this.isEntityListSelected,
|
||||
this.addRemarks})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_EntityListCheckboxSearchFavProceduresWidgetState createState() =>
|
||||
_EntityListCheckboxSearchFavProceduresWidgetState();
|
||||
}
|
||||
|
||||
class _EntityListCheckboxSearchFavProceduresWidgetState
|
||||
extends State<EntityListCheckboxSearchFavProceduresWidget> {
|
||||
int selectedType = 0;
|
||||
int typeUrgent;
|
||||
int typeRegular;
|
||||
|
||||
setSelectedType(int val) {
|
||||
setState(() {
|
||||
selectedType = val;
|
||||
});
|
||||
}
|
||||
|
||||
List<ProcedureTempleteModel> items = List();
|
||||
List<String> remarksList = List();
|
||||
List<int> typeList = List();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
items.addAll(widget.masterList);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
TextEditingController remarksController = TextEditingController();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: Column(
|
||||
children: [
|
||||
NetworkBaseView(
|
||||
baseViewModel: widget.model,
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height * 0.75,
|
||||
child: Center(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 15),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Colors.white),
|
||||
child: ListView(
|
||||
children: [
|
||||
TextFields(
|
||||
hintText: TranslationBase.of(context).searchProcedures,
|
||||
suffixIcon: EvaIcons.search,
|
||||
suffixIconColor: Color(0xff2B353E),
|
||||
// onChanged: (value) {
|
||||
// filterSearchResults(value);
|
||||
// },
|
||||
hasBorder: false,
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
items.length != 0
|
||||
? Column(
|
||||
children: items.map((historyInfo) {
|
||||
return Column(
|
||||
children: [
|
||||
ExpansionTile(
|
||||
title: Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: widget.isEntityListSelected(
|
||||
historyInfo),
|
||||
activeColor: Color(0xffD02127),
|
||||
onChanged: (bool newValue) {
|
||||
setState(() {
|
||||
if (widget.isEntityListSelected(
|
||||
historyInfo)) {
|
||||
widget.removeHistory(
|
||||
historyInfo);
|
||||
} else {
|
||||
widget
|
||||
.addHistory(historyInfo);
|
||||
}
|
||||
});
|
||||
}),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 0),
|
||||
child: AppText('sss',
|
||||
fontSize: 14.0,
|
||||
variant: "bodyText",
|
||||
bold: true,
|
||||
color: Color(0xff575757)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
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: selectedType,
|
||||
// onChanged: (value) {
|
||||
// historyInfo.type =
|
||||
// setSelectedType(value)
|
||||
// .toString();
|
||||
//
|
||||
// historyInfo.type =
|
||||
// value.toString();
|
||||
// },
|
||||
// ),
|
||||
// AppText(
|
||||
// 'routine',
|
||||
// color: Color(0xff575757),
|
||||
// fontWeight: FontWeight.w600,
|
||||
// ),
|
||||
// Radio(
|
||||
// activeColor:
|
||||
// Color(0xFFD02127),
|
||||
// groupValue: selectedType,
|
||||
// value: 1,
|
||||
// onChanged: (value) {
|
||||
// historyInfo.type =
|
||||
// setSelectedType(value)
|
||||
// .toString();
|
||||
//
|
||||
// historyInfo.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: 12.0),
|
||||
// child: TextFields(
|
||||
// hintText: TranslationBase.of(context)
|
||||
// .remarks,
|
||||
// //controller: remarksController,
|
||||
// onChanged: (value) {
|
||||
// historyInfo.remarks = value;
|
||||
// },
|
||||
// minLines: 3,
|
||||
// maxLines: 5,
|
||||
// borderWidth: 0.5,
|
||||
// borderColor: Colors.grey[500],
|
||||
// ),
|
||||
// ),
|
||||
DividerWithSpacesAround(),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
)
|
||||
: Center(
|
||||
child: Container(
|
||||
child: AppText("Sorry , No Match",
|
||||
color: Color(0xFFB9382C)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// void filterSearchResults(String query) {
|
||||
// List<ProcedureTempleteModel> dummySearchList = List();
|
||||
// dummySearchList.addAll(widget.masterList);
|
||||
// if (query.isNotEmpty) {
|
||||
// List<EntityList> dummyListData = List();
|
||||
// dummySearchList.forEach((item) {
|
||||
// if (item.procedureName.toLowerCase().contains(query.toLowerCase())) {
|
||||
// dummyListData.add(item);
|
||||
// }
|
||||
// });
|
||||
// setState(() {
|
||||
// items.clear();
|
||||
// items.addAll(dummyListData);
|
||||
// });
|
||||
// return;
|
||||
// } else {
|
||||
// setState(() {
|
||||
// items.clear();
|
||||
// items.addAll(widget.masterList);
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
}
|
||||
Loading…
Reference in New Issue