You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
115 lines
4.5 KiB
Dart
115 lines
4.5 KiB
Dart
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_templateModel.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/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/util/dr_app_toast_msg.dart';
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_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/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<ProcedureTempleteDetailsModel> entityList = List();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BaseView<ProcedureViewModel>(
|
|
onModelReady: (model) async {
|
|
if (model.procedureTemplate.length == 0) {
|
|
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.procedureTemplate.length != 0)
|
|
Expanded(
|
|
child: NetworkBaseView(
|
|
baseViewModel: model,
|
|
child: EntityListCheckboxSearchFavProceduresWidget(
|
|
model: widget.model,
|
|
masterList: widget.model.procedureTemplate,
|
|
removeFavProcedure: (item) {
|
|
setState(() {
|
|
entityList.remove(item);
|
|
});
|
|
},
|
|
addFavProcedure: (history) {
|
|
setState(() {
|
|
entityList.add(history);
|
|
});
|
|
},
|
|
addSelectedHistories: () {
|
|
//TODO build your fun herr
|
|
// widget.addSelectedHistories();
|
|
},
|
|
isEntityFavListSelected: (master) =>
|
|
isEntityListSelected(master),
|
|
)),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
child: Wrap(
|
|
alignment: WrapAlignment.center,
|
|
children: <Widget>[
|
|
AppButton(
|
|
title: TranslationBase.of(context).addSelectedProcedures,
|
|
color: Color(0xff359846),
|
|
fontWeight: FontWeight.w700,
|
|
onPressed: () {
|
|
if (entityList.isEmpty == true) {
|
|
DrAppToastMsg.showErrorToast(
|
|
TranslationBase.of(context)
|
|
.fillTheMandatoryProcedureDetails,
|
|
);
|
|
return;
|
|
}
|
|
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) {
|
|
Iterable<ProcedureTempleteDetailsModel> history = entityList
|
|
.where((element) => masterKey.templateID == element.templateID && masterKey.procedureName == element.procedureName);
|
|
if (history.length > 0) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|