Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into SOAP
commit
d8ac550357
@ -1,18 +1,90 @@
|
|||||||
class CategoriseProcedureModel {
|
class CategoriseProcedureModel {
|
||||||
String categoryID;
|
List<EntityList> entityList;
|
||||||
String categoryName;
|
int rowcount;
|
||||||
|
dynamic statusMessage;
|
||||||
|
|
||||||
CategoriseProcedureModel({this.categoryID, this.categoryName});
|
CategoriseProcedureModel(
|
||||||
|
{this.entityList, this.rowcount, this.statusMessage});
|
||||||
|
|
||||||
CategoriseProcedureModel.fromJson(Map<String, dynamic> json) {
|
CategoriseProcedureModel.fromJson(Map<String, dynamic> json) {
|
||||||
categoryID = json['CategoryID'];
|
if (json['entityList'] != null) {
|
||||||
categoryName = json['CategoryName'];
|
entityList = new List<EntityList>();
|
||||||
|
json['entityList'].forEach((v) {
|
||||||
|
entityList.add(new EntityList.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
rowcount = json['rowcount'];
|
||||||
|
statusMessage = json['statusMessage'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
if (this.entityList != null) {
|
||||||
|
data['entityList'] = this.entityList.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
data['rowcount'] = this.rowcount;
|
||||||
|
data['statusMessage'] = this.statusMessage;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class EntityList {
|
||||||
|
bool allowedClinic;
|
||||||
|
String category;
|
||||||
|
String categoryID;
|
||||||
|
String genderValidation;
|
||||||
|
String group;
|
||||||
|
String orderedValidation;
|
||||||
|
dynamic price;
|
||||||
|
String procedureId;
|
||||||
|
String procedureName;
|
||||||
|
String specialPermission;
|
||||||
|
String subGroup;
|
||||||
|
String template;
|
||||||
|
|
||||||
|
EntityList(
|
||||||
|
{this.allowedClinic,
|
||||||
|
this.category,
|
||||||
|
this.categoryID,
|
||||||
|
this.genderValidation,
|
||||||
|
this.group,
|
||||||
|
this.orderedValidation,
|
||||||
|
this.price,
|
||||||
|
this.procedureId,
|
||||||
|
this.procedureName,
|
||||||
|
this.specialPermission,
|
||||||
|
this.subGroup,
|
||||||
|
this.template});
|
||||||
|
|
||||||
|
EntityList.fromJson(Map<String, dynamic> json) {
|
||||||
|
allowedClinic = json['allowedClinic'];
|
||||||
|
category = json['category'];
|
||||||
|
categoryID = json['categoryID'];
|
||||||
|
genderValidation = json['genderValidation'];
|
||||||
|
group = json['group'];
|
||||||
|
orderedValidation = json['orderedValidation'];
|
||||||
|
price = json['price'];
|
||||||
|
procedureId = json['procedureId'];
|
||||||
|
procedureName = json['procedureName'];
|
||||||
|
specialPermission = json['specialPermission'];
|
||||||
|
subGroup = json['subGroup'];
|
||||||
|
template = json['template'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
data['CategoryID'] = this.categoryID;
|
data['allowedClinic'] = this.allowedClinic;
|
||||||
data['CategoryName'] = this.categoryName;
|
data['category'] = this.category;
|
||||||
|
data['categoryID'] = this.categoryID;
|
||||||
|
data['genderValidation'] = this.genderValidation;
|
||||||
|
data['group'] = this.group;
|
||||||
|
data['orderedValidation'] = this.orderedValidation;
|
||||||
|
data['price'] = this.price;
|
||||||
|
data['procedureId'] = this.procedureId;
|
||||||
|
data['procedureName'] = this.procedureName;
|
||||||
|
data['specialPermission'] = this.specialPermission;
|
||||||
|
data['subGroup'] = this.subGroup;
|
||||||
|
data['template'] = this.template;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,148 @@
|
|||||||
|
import 'package:doctor_app_flutter/core/enum/viewstate.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/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/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 EntityListCheckboxSearchWidget extends StatefulWidget {
|
||||||
|
final ProcedureViewModel model;
|
||||||
|
final Function addSelectedHistories;
|
||||||
|
final Function(EntityList) removeHistory;
|
||||||
|
final Function(EntityList) addHistory;
|
||||||
|
final bool Function(EntityList) isEntityListSelected;
|
||||||
|
final List<EntityList> masterList;
|
||||||
|
|
||||||
|
EntityListCheckboxSearchWidget(
|
||||||
|
{Key key,
|
||||||
|
this.model,
|
||||||
|
this.addSelectedHistories,
|
||||||
|
this.removeHistory,
|
||||||
|
this.masterList,
|
||||||
|
this.addHistory,
|
||||||
|
this.isEntityListSelected})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_EntityListCheckboxSearchWidgetState createState() => _EntityListCheckboxSearchWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _EntityListCheckboxSearchWidgetState extends State<EntityListCheckboxSearchWidget> {
|
||||||
|
List<EntityList> items = List();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
items.addAll(widget.masterList);
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: widget.model,
|
||||||
|
child: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.5,
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.only(top: 15),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
TextFields(
|
||||||
|
hintText: 'Search ',
|
||||||
|
suffixIcon: EvaIcons.search,
|
||||||
|
onChanged: (value) {
|
||||||
|
filterSearchResults(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(height: 15,),
|
||||||
|
Column(
|
||||||
|
children: items.map((historyInfo) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value:
|
||||||
|
widget.isEntityListSelected(historyInfo),
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
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: Texts(historyInfo.procedureName,
|
||||||
|
variant: "bodyText",
|
||||||
|
bold: true,
|
||||||
|
color: Colors.black),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
DividerWithSpacesAround(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
if (widget.model.state == ViewState.Idle)
|
||||||
|
AppButton(//TODO change the button name
|
||||||
|
title: "Add ".toUpperCase(),
|
||||||
|
onPressed: () {
|
||||||
|
widget.addSelectedHistories();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void filterSearchResults(String query) {
|
||||||
|
List<EntityList> 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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,151 @@
|
|||||||
|
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/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/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 MasterKeyCheckboxSearchWidget extends StatefulWidget {
|
||||||
|
final SOAPViewModel model;
|
||||||
|
final Function addSelectedHistories;
|
||||||
|
final Function(MasterKeyModel) removeHistory;
|
||||||
|
final Function(MasterKeyModel) addHistory;
|
||||||
|
final bool Function(MasterKeyModel) isServiceSelected;
|
||||||
|
final List<MasterKeyModel> masterList;
|
||||||
|
final String buttonName;
|
||||||
|
final String hintSearchText;
|
||||||
|
|
||||||
|
MasterKeyCheckboxSearchWidget(
|
||||||
|
{Key key,
|
||||||
|
this.model,
|
||||||
|
this.addSelectedHistories,
|
||||||
|
this.removeHistory,
|
||||||
|
this.masterList,
|
||||||
|
this.addHistory,
|
||||||
|
this.isServiceSelected, this.buttonName, this.hintSearchText})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MasterKeyCheckboxSearchWidgetState createState() => _MasterKeyCheckboxSearchWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MasterKeyCheckboxSearchWidgetState extends State<MasterKeyCheckboxSearchWidget> {
|
||||||
|
List<MasterKeyModel> items = List();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
items.addAll(widget.masterList);
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: widget.model,
|
||||||
|
child: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.5,
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.only(top: 15),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
TextFields(
|
||||||
|
hintText: widget.hintSearchText??'Search history',
|
||||||
|
suffixIcon: EvaIcons.search,
|
||||||
|
onChanged: (value) {
|
||||||
|
filterSearchResults(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(height: 15,),
|
||||||
|
Column(
|
||||||
|
children: items.map((historyInfo) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value:
|
||||||
|
widget.isServiceSelected(historyInfo),
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (bool newValue) {
|
||||||
|
setState(() {
|
||||||
|
if (widget
|
||||||
|
.isServiceSelected(historyInfo)) {
|
||||||
|
widget.removeHistory(historyInfo);
|
||||||
|
} else {
|
||||||
|
widget.addHistory(historyInfo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 10, vertical: 0),
|
||||||
|
child: Texts(historyInfo.nameEn,
|
||||||
|
variant: "bodyText",
|
||||||
|
bold: true,
|
||||||
|
color: Colors.black),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
DividerWithSpacesAround(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
if (widget.model.state == ViewState.Idle)
|
||||||
|
AppButton(
|
||||||
|
title: widget.buttonName?? "Add SELECTED HISTORIES".toUpperCase(),
|
||||||
|
onPressed: () {
|
||||||
|
widget.addSelectedHistories();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void filterSearchResults(String query) {
|
||||||
|
List<MasterKeyModel> dummySearchList = List();
|
||||||
|
dummySearchList.addAll(widget.masterList);
|
||||||
|
if (query.isNotEmpty) {
|
||||||
|
List<MasterKeyModel> dummyListData = List();
|
||||||
|
dummySearchList.forEach((item) {
|
||||||
|
if (item.nameAr.toLowerCase().contains(query.toLowerCase()) ||
|
||||||
|
item.nameEn.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