|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart';
|
|
|
|
@ -19,10 +20,15 @@ class AddHistoryDialog extends StatefulWidget {
|
|
|
|
|
final PageController controller;
|
|
|
|
|
final List<MySelectedHistory> myHistoryList;
|
|
|
|
|
final Function addSelectedHistories;
|
|
|
|
|
final Function (MasterKeyModel) removeHistory;
|
|
|
|
|
final Function(MasterKeyModel) removeHistory;
|
|
|
|
|
|
|
|
|
|
const AddHistoryDialog(
|
|
|
|
|
{Key key, this.changePageViewIndex, this.controller, this.myHistoryList, this.addSelectedHistories, this.removeHistory})
|
|
|
|
|
{Key key,
|
|
|
|
|
this.changePageViewIndex,
|
|
|
|
|
this.controller,
|
|
|
|
|
this.myHistoryList,
|
|
|
|
|
this.addSelectedHistories,
|
|
|
|
|
this.removeHistory})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@ -51,96 +57,96 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
appBar: BottomSheetTitle(
|
|
|
|
|
title: TranslationBase.of(context).addHistory),
|
|
|
|
|
body: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
BottomSheetTitle(title:TranslationBase.of(context).addHistory),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
PriorityBar(onTap: (activePriority) async {
|
|
|
|
|
widget.changePageViewIndex(activePriority);
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: PageView(
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
controller: widget.controller,
|
|
|
|
|
onPageChanged: (index) {
|
|
|
|
|
setState(() {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
NetworkBaseView(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
child: MasterKeyCheckboxSearchWidget(
|
|
|
|
|
model: model,
|
|
|
|
|
masterList: model.historyFamilyList,
|
|
|
|
|
removeHistory: (history){
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.removeHistory(history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addHistory: (history){
|
|
|
|
|
setState(() {
|
|
|
|
|
createAndAddHistory(
|
|
|
|
|
history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addSelectedHistories: (){
|
|
|
|
|
widget.addSelectedHistories();
|
|
|
|
|
},
|
|
|
|
|
isServiceSelected: (master) =>isServiceSelected(master),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
NetworkBaseView(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
child: MasterKeyCheckboxSearchWidget(
|
|
|
|
|
model: model,
|
|
|
|
|
masterList: model.mergeHistorySurgicalWithHistorySportList,
|
|
|
|
|
removeHistory: (history){
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.removeHistory(history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addHistory: (history){
|
|
|
|
|
setState(() {
|
|
|
|
|
createAndAddHistory(
|
|
|
|
|
history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addSelectedHistories: (){
|
|
|
|
|
widget.addSelectedHistories();
|
|
|
|
|
},
|
|
|
|
|
isServiceSelected: (master) =>isServiceSelected(master),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
NetworkBaseView(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
child: MasterKeyCheckboxSearchWidget(
|
|
|
|
|
model: model,
|
|
|
|
|
masterList: model.historyMedicalList,
|
|
|
|
|
removeHistory: (history){
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.removeHistory(history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addHistory: (history){
|
|
|
|
|
setState(() {
|
|
|
|
|
createAndAddHistory(
|
|
|
|
|
history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addSelectedHistories: (){
|
|
|
|
|
widget.addSelectedHistories();
|
|
|
|
|
},
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
PriorityBar(onTap: (activePriority) async {
|
|
|
|
|
widget.changePageViewIndex(activePriority);
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: PageView(
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
controller: widget.controller,
|
|
|
|
|
onPageChanged: (index) {
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
NetworkBaseView(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
child: MasterKeyCheckboxSearchWidget(
|
|
|
|
|
model: model,
|
|
|
|
|
masterList: model.historyFamilyList,
|
|
|
|
|
removeHistory: (history) {
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.removeHistory(history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addHistory: (history) {
|
|
|
|
|
setState(() {
|
|
|
|
|
createAndAddHistory(history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addSelectedHistories: () {
|
|
|
|
|
widget.addSelectedHistories();
|
|
|
|
|
},
|
|
|
|
|
isServiceSelected: (master) =>
|
|
|
|
|
isServiceSelected(master),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
NetworkBaseView(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
child: MasterKeyCheckboxSearchWidget(
|
|
|
|
|
model: model,
|
|
|
|
|
masterList: model
|
|
|
|
|
.mergeHistorySurgicalWithHistorySportList,
|
|
|
|
|
removeHistory: (history) {
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.removeHistory(history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addHistory: (history) {
|
|
|
|
|
setState(() {
|
|
|
|
|
createAndAddHistory(history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addSelectedHistories: () {
|
|
|
|
|
widget.addSelectedHistories();
|
|
|
|
|
},
|
|
|
|
|
isServiceSelected: (master) =>
|
|
|
|
|
isServiceSelected(master),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
NetworkBaseView(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
child: MasterKeyCheckboxSearchWidget(
|
|
|
|
|
model: model,
|
|
|
|
|
masterList: model.historyMedicalList,
|
|
|
|
|
removeHistory: (history) {
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.removeHistory(history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addHistory: (history) {
|
|
|
|
|
setState(() {
|
|
|
|
|
createAndAddHistory(history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addSelectedHistories: () {
|
|
|
|
|
widget.addSelectedHistories();
|
|
|
|
|
},
|
|
|
|
|
isServiceSelected: (master) =>
|
|
|
|
|
isServiceSelected(master),
|
|
|
|
|
),
|
|
|
|
@ -149,59 +155,63 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * 0.11 ,)
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.11,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(0.0),
|
|
|
|
|
),
|
|
|
|
|
border: Border.all(color: HexColor('#707070'), width: 0),
|
|
|
|
|
),
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.1,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: .80,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title:
|
|
|
|
|
TranslationBase.of(context).addSelectedHistories,
|
|
|
|
|
padding: 10,
|
|
|
|
|
color: Color(0xFF359846),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
widget.addSelectedHistories();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: model.state == ViewState.Busy
|
|
|
|
|
? Container(
|
|
|
|
|
height: 0,
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(0.0),
|
|
|
|
|
),
|
|
|
|
|
border: Border.all(color: HexColor('#707070'), width: 0),
|
|
|
|
|
),
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.1,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: .80,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: TranslationBase.of(context)
|
|
|
|
|
.addSelectedHistories,
|
|
|
|
|
padding: 10,
|
|
|
|
|
color: Color(0xFF359846),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
widget.addSelectedHistories();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
createAndAddHistory(MasterKeyModel history) {
|
|
|
|
|
List<MySelectedHistory> myhistory = widget.myHistoryList.where((element) =>
|
|
|
|
|
history.id ==
|
|
|
|
|
element.selectedHistory.id &&
|
|
|
|
|
history.typeId ==
|
|
|
|
|
element.selectedHistory.typeId
|
|
|
|
|
).toList();
|
|
|
|
|
List<MySelectedHistory> myhistory = widget.myHistoryList
|
|
|
|
|
.where((element) =>
|
|
|
|
|
history.id == element.selectedHistory.id &&
|
|
|
|
|
history.typeId == element.selectedHistory.typeId)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
if (myhistory.isEmpty) {
|
|
|
|
|
setState(() {
|
|
|
|
@ -217,18 +227,14 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isServiceSelected(MasterKeyModel masterKey) {
|
|
|
|
|
Iterable<MySelectedHistory> history =
|
|
|
|
|
widget
|
|
|
|
|
.myHistoryList
|
|
|
|
|
.where((element) =>
|
|
|
|
|
masterKey.id == element.selectedHistory.id &&
|
|
|
|
|
masterKey.typeId == element.selectedHistory.typeId &&
|
|
|
|
|
element.isChecked);
|
|
|
|
|
Iterable<MySelectedHistory> history = widget.myHistoryList.where(
|
|
|
|
|
(element) =>
|
|
|
|
|
masterKey.id == element.selectedHistory.id &&
|
|
|
|
|
masterKey.typeId == element.selectedHistory.typeId &&
|
|
|
|
|
element.isChecked);
|
|
|
|
|
if (history.length > 0) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|