|
|
|
|
@ -1,9 +1,11 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
@ -40,9 +42,12 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
|
|
|
|
|
color: Colors.blue,
|
|
|
|
|
size: 29.0,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
List<CategoriseParentModel> entityList = List();
|
|
|
|
|
List<CategoriseParentModel> entityListBrands = List();
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
TextEditingController minField = TextEditingController();
|
|
|
|
|
TextEditingController maxField = TextEditingController();
|
|
|
|
|
return BaseView<PharmacyCategoriseViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getSubCategorise(i: id),
|
|
|
|
|
builder: (BuildContext context, PharmacyCategoriseViewModel model,
|
|
|
|
|
@ -281,6 +286,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
|
|
|
|
|
return SingleChildScrollView(
|
|
|
|
|
controller: scrollController,
|
|
|
|
|
child: Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
height: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height *
|
|
|
|
|
@ -332,45 +338,34 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
|
|
|
|
|
title:
|
|
|
|
|
Texts('Categorise'),
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
height: 350,
|
|
|
|
|
child: ListView
|
|
|
|
|
.builder(
|
|
|
|
|
controller:
|
|
|
|
|
scrollController,
|
|
|
|
|
scrollDirection:
|
|
|
|
|
Axis
|
|
|
|
|
.vertical,
|
|
|
|
|
shrinkWrap:
|
|
|
|
|
true,
|
|
|
|
|
itemCount: model
|
|
|
|
|
.categoriseParent
|
|
|
|
|
.length,
|
|
|
|
|
itemBuilder:
|
|
|
|
|
(BuildContext
|
|
|
|
|
context,
|
|
|
|
|
int index) {
|
|
|
|
|
return CheckboxListTile(
|
|
|
|
|
tristate:
|
|
|
|
|
true,
|
|
|
|
|
title: Texts(model
|
|
|
|
|
.categoriseParent[index]
|
|
|
|
|
.name),
|
|
|
|
|
controlAffinity:
|
|
|
|
|
ListTileControlAffinity.leading,
|
|
|
|
|
value:
|
|
|
|
|
checkedCategorise,
|
|
|
|
|
onChanged:
|
|
|
|
|
(bool
|
|
|
|
|
value) {
|
|
|
|
|
setState(
|
|
|
|
|
() {
|
|
|
|
|
checkedCategorise =
|
|
|
|
|
value;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
ProcedureListWidget(
|
|
|
|
|
model: model,
|
|
|
|
|
masterList: model
|
|
|
|
|
.subCategorise,
|
|
|
|
|
removeHistory:
|
|
|
|
|
(item) {
|
|
|
|
|
setState(() {
|
|
|
|
|
entityList
|
|
|
|
|
.remove(
|
|
|
|
|
item);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addHistory:
|
|
|
|
|
(history) {
|
|
|
|
|
setState(() {
|
|
|
|
|
entityList.add(
|
|
|
|
|
history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addSelectedHistories:
|
|
|
|
|
() {
|
|
|
|
|
//TODO build your fun herr
|
|
|
|
|
// widget.addSelectedHistories();
|
|
|
|
|
},
|
|
|
|
|
isEntityListSelected:
|
|
|
|
|
(master) =>
|
|
|
|
|
isEntityListSelected(
|
|
|
|
|
master),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -381,45 +376,35 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
|
|
|
|
|
ExpansionTile(
|
|
|
|
|
title: Texts('Brands'),
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
height: 350,
|
|
|
|
|
child: ListView
|
|
|
|
|
.builder(
|
|
|
|
|
scrollDirection:
|
|
|
|
|
Axis
|
|
|
|
|
.vertical,
|
|
|
|
|
shrinkWrap:
|
|
|
|
|
true,
|
|
|
|
|
itemCount: model
|
|
|
|
|
.brandsList
|
|
|
|
|
.length,
|
|
|
|
|
itemBuilder:
|
|
|
|
|
(BuildContext
|
|
|
|
|
context,
|
|
|
|
|
int index) {
|
|
|
|
|
return CheckboxListTile(
|
|
|
|
|
tristate:
|
|
|
|
|
true,
|
|
|
|
|
title: Texts(model
|
|
|
|
|
.brandsList[index]
|
|
|
|
|
.name),
|
|
|
|
|
controlAffinity:
|
|
|
|
|
ListTileControlAffinity.leading,
|
|
|
|
|
value:
|
|
|
|
|
checkedBrands,
|
|
|
|
|
onChanged:
|
|
|
|
|
(bool
|
|
|
|
|
value) {
|
|
|
|
|
setState(
|
|
|
|
|
() {
|
|
|
|
|
checkedBrands =
|
|
|
|
|
value;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
autofocus:
|
|
|
|
|
true,
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
ProcedureListWidget(
|
|
|
|
|
model: model,
|
|
|
|
|
masterList: model
|
|
|
|
|
.brandsList,
|
|
|
|
|
removeHistory:
|
|
|
|
|
(item) {
|
|
|
|
|
setState(() {
|
|
|
|
|
entityListBrands
|
|
|
|
|
.remove(
|
|
|
|
|
item);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addHistory:
|
|
|
|
|
(history) {
|
|
|
|
|
setState(() {
|
|
|
|
|
entityListBrands
|
|
|
|
|
.add(
|
|
|
|
|
history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addSelectedHistories:
|
|
|
|
|
() {
|
|
|
|
|
//TODO build your fun herr
|
|
|
|
|
// widget.addSelectedHistories();
|
|
|
|
|
},
|
|
|
|
|
isEntityListSelected:
|
|
|
|
|
(master) =>
|
|
|
|
|
isEntityListSelectedBrands(
|
|
|
|
|
master),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -459,6 +444,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
|
|
|
|
|
border:
|
|
|
|
|
OutlineInputBorder(),
|
|
|
|
|
),
|
|
|
|
|
controller:
|
|
|
|
|
minField,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -484,6 +471,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
|
|
|
|
|
border:
|
|
|
|
|
OutlineInputBorder(),
|
|
|
|
|
),
|
|
|
|
|
controller:
|
|
|
|
|
maxField,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -526,6 +515,50 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
|
|
|
|
|
Container(
|
|
|
|
|
width: 200,
|
|
|
|
|
child: Button(
|
|
|
|
|
onTap: () {
|
|
|
|
|
String
|
|
|
|
|
categoriesId =
|
|
|
|
|
"";
|
|
|
|
|
for (CategoriseParentModel category
|
|
|
|
|
in entityList) {
|
|
|
|
|
if (categoriesId ==
|
|
|
|
|
"") {
|
|
|
|
|
categoriesId =
|
|
|
|
|
category
|
|
|
|
|
.id;
|
|
|
|
|
} else {
|
|
|
|
|
categoriesId =
|
|
|
|
|
"$categoriesId,${category.id}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
String
|
|
|
|
|
brandIds =
|
|
|
|
|
"";
|
|
|
|
|
for (CategoriseParentModel brand
|
|
|
|
|
in entityListBrands) {
|
|
|
|
|
if (brandIds ==
|
|
|
|
|
"") {
|
|
|
|
|
brandIds =
|
|
|
|
|
brand
|
|
|
|
|
.id;
|
|
|
|
|
} else {
|
|
|
|
|
brandIds =
|
|
|
|
|
"$brandIds,${brand.id}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.getFilteredProducts(
|
|
|
|
|
min: minField
|
|
|
|
|
.text
|
|
|
|
|
.toString(),
|
|
|
|
|
max: maxField
|
|
|
|
|
.text
|
|
|
|
|
.toString(),
|
|
|
|
|
categoryId:
|
|
|
|
|
categoriesId,
|
|
|
|
|
brandId:
|
|
|
|
|
brandIds);
|
|
|
|
|
},
|
|
|
|
|
label: 'Apply',
|
|
|
|
|
backgroundColor:
|
|
|
|
|
Colors
|
|
|
|
|
@ -994,4 +1027,22 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isEntityListSelected(CategoriseParentModel masterKey) {
|
|
|
|
|
Iterable<CategoriseParentModel> history =
|
|
|
|
|
entityList.where((element) => masterKey.id == element.id);
|
|
|
|
|
if (history.length > 0) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isEntityListSelectedBrands(CategoriseParentModel masterKey) {
|
|
|
|
|
Iterable<CategoriseParentModel> history =
|
|
|
|
|
entityListBrands.where((element) => masterKey.id == element.id);
|
|
|
|
|
if (history.length > 0) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|