|
|
|
|
@ -1,18 +1,15 @@
|
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
|
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/core/viewModel/project_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';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
|
|
|
|
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
|
@ -20,7 +17,7 @@ import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class UpdateHistoryWidget extends StatefulWidget {
|
|
|
|
|
final List<MasterKeyModel> myHistoryList;
|
|
|
|
|
final List<MySelectedHistory> myHistoryList;
|
|
|
|
|
|
|
|
|
|
const UpdateHistoryWidget({Key key, this.myHistoryList}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@ -86,19 +83,28 @@ class _UpdateHistoryWidgetState extends State<UpdateHistoryWidget>
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
child: Expanded(
|
|
|
|
|
child: Texts(projectViewModel.isArabic?myHistory.nameAr:myHistory.nameEn,
|
|
|
|
|
variant: "bodyText", bold: true, color: Colors.black),
|
|
|
|
|
child: Texts(
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
? myHistory.selectedHistory.nameAr
|
|
|
|
|
: myHistory.selectedHistory.nameEn,
|
|
|
|
|
variant: "bodyText",
|
|
|
|
|
textDecoration: myHistory.isChecked
|
|
|
|
|
? null
|
|
|
|
|
: TextDecoration.lineThrough,
|
|
|
|
|
bold: true,
|
|
|
|
|
color: Colors.black),
|
|
|
|
|
),
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.7,
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
child: Icon(
|
|
|
|
|
FontAwesomeIcons.trash,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
size: 20,
|
|
|
|
|
),
|
|
|
|
|
onTap: () => removeHistory(myHistory),
|
|
|
|
|
)
|
|
|
|
|
if (myHistory.isChecked)
|
|
|
|
|
InkWell(
|
|
|
|
|
child: Icon(
|
|
|
|
|
FontAwesomeIcons.trash,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
size: 20,
|
|
|
|
|
),
|
|
|
|
|
onTap: () => removeHistory(myHistory.selectedHistory),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -113,13 +119,24 @@ class _UpdateHistoryWidgetState extends State<UpdateHistoryWidget>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeHistory(MasterKeyModel masterKey) {
|
|
|
|
|
Iterable<MasterKeyModel> history = widget.myHistoryList.where((element) =>
|
|
|
|
|
masterKey.id == element.id && masterKey.typeId == element.typeId);
|
|
|
|
|
removeHistory(MasterKeyModel historyKey) {
|
|
|
|
|
// Iterable<MasterKeyModel> history = widget.myHistoryList.where((element) =>
|
|
|
|
|
// masterKey.id == element.id && masterKey.typeId == element.typeId);
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
List<MySelectedHistory> history =
|
|
|
|
|
// ignore: missing_return
|
|
|
|
|
widget.myHistoryList.where((element) =>
|
|
|
|
|
historyKey.id ==
|
|
|
|
|
element.selectedHistory.id &&
|
|
|
|
|
historyKey.typeId ==
|
|
|
|
|
element.selectedHistory.typeId
|
|
|
|
|
).toList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (history.length > 0)
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.myHistoryList.remove(history.first);
|
|
|
|
|
history[0].isChecked = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -233,7 +250,7 @@ class _PriorityBarState extends State<PriorityBar> {
|
|
|
|
|
class AddHistoryDialog extends StatefulWidget {
|
|
|
|
|
final Function changePageViewIndex;
|
|
|
|
|
final PageController controller;
|
|
|
|
|
final List<MasterKeyModel> myHistoryList;
|
|
|
|
|
final List<MySelectedHistory> myHistoryList;
|
|
|
|
|
final Function addSelectedHistories;
|
|
|
|
|
final Function (MasterKeyModel) removeHistory;
|
|
|
|
|
|
|
|
|
|
@ -306,7 +323,8 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
},
|
|
|
|
|
addHistory: (history){
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.myHistoryList.add(history);
|
|
|
|
|
createAndAddHistory(
|
|
|
|
|
history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addSelectedHistories: (){
|
|
|
|
|
@ -324,7 +342,8 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
},
|
|
|
|
|
addHistory: (history){
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.myHistoryList.add(history);
|
|
|
|
|
createAndAddHistory(
|
|
|
|
|
history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addSelectedHistories: (){
|
|
|
|
|
@ -342,7 +361,8 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
},
|
|
|
|
|
addHistory: (history){
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.myHistoryList.add(history);
|
|
|
|
|
createAndAddHistory(
|
|
|
|
|
history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addSelectedHistories: (){
|
|
|
|
|
@ -361,12 +381,35 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
createAndAddHistory(MasterKeyModel history) {
|
|
|
|
|
List<MySelectedHistory> myhistory = widget.myHistoryList.where((element) =>
|
|
|
|
|
history.id ==
|
|
|
|
|
element.selectedHistory.id &&
|
|
|
|
|
history.typeId ==
|
|
|
|
|
element.selectedHistory.typeId
|
|
|
|
|
).toList();
|
|
|
|
|
|
|
|
|
|
if (myhistory.isEmpty) {
|
|
|
|
|
setState(() {
|
|
|
|
|
MySelectedHistory mySelectedHistory = MySelectedHistory(
|
|
|
|
|
remark: history.remarks ?? "",
|
|
|
|
|
selectedHistory: history,
|
|
|
|
|
isChecked: true);
|
|
|
|
|
widget.myHistoryList.add(mySelectedHistory);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
myhistory.first.isChecked = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isServiceSelected(MasterKeyModel masterKey) {
|
|
|
|
|
Iterable<MasterKeyModel> history =
|
|
|
|
|
Iterable<MySelectedHistory> history =
|
|
|
|
|
widget
|
|
|
|
|
.myHistoryList
|
|
|
|
|
.where((element) =>
|
|
|
|
|
masterKey.id == element.id && masterKey.typeId == element.typeId);
|
|
|
|
|
masterKey.id == element.selectedHistory.id &&
|
|
|
|
|
masterKey.typeId == element.selectedHistory.typeId &&
|
|
|
|
|
element.isChecked);
|
|
|
|
|
if (history.length > 0) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|