mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 19:48:56 +03:30
fix bugs!
This commit is contained in:
@@ -33,6 +33,7 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
|
||||
final batchId = randomString(10);
|
||||
|
||||
int curLabelVal = 1;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
descriptionCTRL.text = '';
|
||||
@@ -43,46 +44,62 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void _saveForm(String name, String size, String specific, String udi,String description) {
|
||||
void _saveForm(String name, String size, String specific, String udi,
|
||||
String description) {
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
Provider.of<ItemProvider>(context, listen: false)
|
||||
.createItemResult(
|
||||
name,
|
||||
size,
|
||||
specific,
|
||||
udi,
|
||||
description,
|
||||
batchId,
|
||||
)
|
||||
.then(
|
||||
(result) {
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
if (result == 'done') {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Item added.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((value) =>
|
||||
Navigator.of(context).popAndPushNamed(Routes.itemResultScreen));
|
||||
} else if (result == 'error') {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('error.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Provider.of<ItemProvider>(context, listen: false)
|
||||
.createItemResult(
|
||||
name,
|
||||
size,
|
||||
specific,
|
||||
udi,
|
||||
description,
|
||||
batchId,
|
||||
)
|
||||
.then(
|
||||
(result) {
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
if (result == 'done') {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Item added.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((value) => Navigator.of(context)
|
||||
.popAndPushNamed(Routes.itemResultScreen));
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -129,7 +146,12 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('Items', style: TextStyle(color: Colors.white,),),
|
||||
title: Text(
|
||||
'Items',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
@@ -360,13 +382,13 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
|
||||
height: 70,
|
||||
),
|
||||
ItemAddSaveButton(
|
||||
onTap: (){
|
||||
onTap: () {
|
||||
_saveForm(
|
||||
nameCTRL.text,
|
||||
sizeCTRL.text,
|
||||
specificCTRL.text,
|
||||
udiCTRL.text,
|
||||
descriptionCTRL.text,
|
||||
nameCTRL.text,
|
||||
sizeCTRL.text,
|
||||
specificCTRL.text,
|
||||
udiCTRL.text,
|
||||
descriptionCTRL.text,
|
||||
);
|
||||
},
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
|
||||
@@ -239,7 +239,24 @@ class ItemProvider extends ChangeNotifier {
|
||||
items = [];
|
||||
searchBoxValue = value;
|
||||
originalItems!.forEach((result) {
|
||||
if (result.udi.toString().contains(searchBoxValue)) {
|
||||
if (
|
||||
result.udi
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.contains(searchBoxValue.toLowerCase()) ||
|
||||
result.udi
|
||||
.toString()
|
||||
.toUpperCase()
|
||||
.contains(searchBoxValue.toUpperCase()) ||
|
||||
result.udi
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.contains(searchBoxValue.toUpperCase()) ||
|
||||
result.udi
|
||||
.toString()
|
||||
.toUpperCase()
|
||||
.contains(searchBoxValue.toLowerCase())
|
||||
) {
|
||||
items!.add(result);
|
||||
}
|
||||
});
|
||||
@@ -289,7 +306,7 @@ class ItemProvider extends ChangeNotifier {
|
||||
userName: item['user'] != null ? item['user']['name'] : '',
|
||||
status: item['status'],
|
||||
udi: item['udi'],
|
||||
packageId: item['package_id'],
|
||||
packageId: item['package_id'].toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -247,7 +247,24 @@ class PackageProvider extends ChangeNotifier {
|
||||
items = [];
|
||||
searchBoxValue = value;
|
||||
originalItems!.forEach((result) {
|
||||
if (result.id.toString().contains(searchBoxValue)) {
|
||||
if (
|
||||
result.id
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.contains(searchBoxValue.toLowerCase()) ||
|
||||
result.id
|
||||
.toString()
|
||||
.toUpperCase()
|
||||
.contains(searchBoxValue.toUpperCase()) ||
|
||||
result.id
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.contains(searchBoxValue.toUpperCase()) ||
|
||||
result.id
|
||||
.toString()
|
||||
.toUpperCase()
|
||||
.contains(searchBoxValue.toLowerCase())
|
||||
) {
|
||||
items!.add(result);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -88,8 +88,10 @@ class TestResultsProvider with ChangeNotifier {
|
||||
}
|
||||
|
||||
int pageNumber = 1;
|
||||
|
||||
void resetPageNumber() => pageNumber = 1;
|
||||
bool isloading = false;
|
||||
|
||||
void resetLoading() {
|
||||
isloading = false;
|
||||
notifyListeners();
|
||||
@@ -109,7 +111,24 @@ class TestResultsProvider with ChangeNotifier {
|
||||
items = [];
|
||||
searchBoxValue = value;
|
||||
originalItems!.forEach((result) {
|
||||
if (result.name.toString().contains(searchBoxValue)) {
|
||||
if (
|
||||
result.name
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.contains(searchBoxValue.toLowerCase()) ||
|
||||
result.name
|
||||
.toString()
|
||||
.toUpperCase()
|
||||
.contains(searchBoxValue.toUpperCase()) ||
|
||||
result.name
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.contains(searchBoxValue.toUpperCase()) ||
|
||||
result.name
|
||||
.toString()
|
||||
.toUpperCase()
|
||||
.contains(searchBoxValue.toLowerCase())
|
||||
) {
|
||||
items!.add(result);
|
||||
}
|
||||
});
|
||||
@@ -333,9 +352,9 @@ class TestResultsProvider with ChangeNotifier {
|
||||
.firstWhere((element) => element.id == data['id'].toString())
|
||||
.result, //az api safheye asli estefade mishavad
|
||||
'description':
|
||||
data['inputs']['Note'] != null ? data['inputs']['Note'] : '',
|
||||
data['inputs']['Note'] != null ? data['inputs']['Note'] : '',
|
||||
'test_type_name':
|
||||
data['test_type']['name'] != null ? data['test_type']['name'] : '',
|
||||
data['test_type']['name'] != null ? data['test_type']['name'] : '',
|
||||
'hospital': originalItems!
|
||||
.firstWhere((element) => element.id == data['id'].toString())
|
||||
.hospital, // az api safheye asli estefade mi shavad
|
||||
|
||||
@@ -88,7 +88,7 @@ class ItemItemBox extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 33 * _deviceBlockSize,
|
||||
width: 50 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
|
||||
Reference in New Issue
Block a user