mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 18:19:03 +03:30
Fix test result status
This commit is contained in:
@@ -29,6 +29,7 @@ class _TestResultScreenState extends State<TestResultScreen> {
|
|||||||
ScrollController? sc;
|
ScrollController? sc;
|
||||||
|
|
||||||
bool _isInit = true;
|
bool _isInit = true;
|
||||||
|
|
||||||
// List<TestResult> _data = [];
|
// List<TestResult> _data = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -82,7 +83,12 @@ class _TestResultScreenState extends State<TestResultScreen> {
|
|||||||
TestResultFloatingButton(deviceBlockSize: _deviceBlockSize),
|
TestResultFloatingButton(deviceBlockSize: _deviceBlockSize),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
titleSpacing: -10,
|
titleSpacing: -10,
|
||||||
title: Text('Home', style: TextStyle(color: Colors.white,),),
|
title: Text(
|
||||||
|
'Home',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
@@ -299,6 +305,7 @@ class _TestResultScreenState extends State<TestResultScreen> {
|
|||||||
|
|
||||||
class TestItemBox extends StatelessWidget {
|
class TestItemBox extends StatelessWidget {
|
||||||
final TestResultObject? item;
|
final TestResultObject? item;
|
||||||
|
|
||||||
const TestItemBox({
|
const TestItemBox({
|
||||||
Key? key,
|
Key? key,
|
||||||
required double deviceBlockSize,
|
required double deviceBlockSize,
|
||||||
@@ -347,7 +354,16 @@ class TestItemBox extends StatelessWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
),
|
),
|
||||||
item!.result == 'Accepted'
|
(item!.verified == 'NotVerified' &&
|
||||||
|
item!.result == 'Not Accepted')
|
||||||
|
? Text(
|
||||||
|
'Rejected',
|
||||||
|
style: TextStyle(
|
||||||
|
color: kPink,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: (item!.verified == 'Verified' &&
|
||||||
|
item!.result == 'Accepted')
|
||||||
? Text(
|
? Text(
|
||||||
'Accepted',
|
'Accepted',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@@ -355,11 +371,11 @@ class TestItemBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
'Rejected',
|
'Pending..',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: kPink,
|
color: Colors.grey,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
@@ -373,9 +389,11 @@ class TestItemBox extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
userData['roles']?.contains('User') ?? false
|
(userData['roles']?.contains('User') &&
|
||||||
? Container()
|
item!.verified != 'verified' &&
|
||||||
: InkWell(
|
item!.hospital
|
||||||
|
.contains(userData['medical_center']))
|
||||||
|
? InkWell(
|
||||||
customBorder: CircleBorder(),
|
customBorder: CircleBorder(),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
@@ -412,7 +430,89 @@ class TestItemBox extends StatelessWidget {
|
|||||||
size: 5 * _deviceBlockSize,
|
size: 5 * _deviceBlockSize,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
: (userData['roles']?.contains('Supervisor') &&
|
||||||
|
item!.verified == 'NotVerified' &&
|
||||||
|
item!.result == 'Not Accepted')
|
||||||
|
? InkWell(
|
||||||
|
customBorder: CircleBorder(),
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text('Delete'),
|
||||||
|
content: Text(
|
||||||
|
'Are you sure you want delete this Test?'),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: Text('Yes'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Provider.of<TestResultsProvider>(
|
||||||
|
context,
|
||||||
|
listen: false)
|
||||||
|
.removeTestResult(item!.id);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
|
TextButton(
|
||||||
|
child: Text('No'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
|
Icons.delete,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: userData['roles']?.contains('Admin') ?? false
|
||||||
|
? InkWell(
|
||||||
|
customBorder: CircleBorder(),
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text('Delete'),
|
||||||
|
content: Text(
|
||||||
|
'Are you sure you want delete this Test?'),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: Text('Yes'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Provider.of<TestResultsProvider>(
|
||||||
|
context,
|
||||||
|
listen: false)
|
||||||
|
.removeTestResult(
|
||||||
|
item!.id);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: Text('No'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
|
Icons.delete,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 7.5,
|
width: 7.5,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -359,6 +359,7 @@ class TestResultsProvider with ChangeNotifier {
|
|||||||
.firstWhere((element) => element.id == data['id'].toString())
|
.firstWhere((element) => element.id == data['id'].toString())
|
||||||
.hospital, // az api safheye asli estefade mi shavad
|
.hospital, // az api safheye asli estefade mi shavad
|
||||||
'files': mediaList,
|
'files': mediaList,
|
||||||
|
'verified' : data['verified']
|
||||||
};
|
};
|
||||||
return result!;
|
return result!;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,13 @@ class DatasBox extends StatelessWidget {
|
|||||||
color: Color.fromRGBO(230, 230, 230, 1),
|
color: Color.fromRGBO(230, 230, 230, 1),
|
||||||
border: Border(
|
border: Border(
|
||||||
left: BorderSide(
|
left: BorderSide(
|
||||||
color: datas['accepted'] == 'Accepted' ? kLightBlue : kPink,
|
color: datas['accepted'] == 'Accepted' &&
|
||||||
|
datas['verified'] == 'Verified'
|
||||||
|
? kLightBlue
|
||||||
|
: datas['accepted'] == 'Not Accepted' &&
|
||||||
|
datas['verified'] == 'NotVerified'
|
||||||
|
? kPink
|
||||||
|
: Colors.grey,
|
||||||
width: 2,
|
width: 2,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -58,14 +64,26 @@ class DatasBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: datas['accepted'] == 'Accepted' ? kLightBlue : kPink,
|
color: datas['accepted'] == 'Accepted' &&
|
||||||
|
datas['verified'] == 'Verified'
|
||||||
|
? kLightBlue
|
||||||
|
: datas['accepted'] == 'Not Accepted' &&
|
||||||
|
datas['verified'] == 'NotVerified'
|
||||||
|
? kPink
|
||||||
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Divider(),
|
Divider(),
|
||||||
Text(
|
Text(
|
||||||
datas['test_type_name'],
|
datas['test_type_name'],
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: datas['accepted'] == 'Accepted' ? kLightBlue : kPink,
|
color: datas['accepted'] == 'Accepted' &&
|
||||||
|
datas['verified'] == 'Verified'
|
||||||
|
? kLightBlue
|
||||||
|
: datas['accepted'] == 'Not Accepted' &&
|
||||||
|
datas['verified'] == 'NotVerified'
|
||||||
|
? kPink
|
||||||
|
: Colors.grey,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -198,15 +216,22 @@ class DatasBox extends StatelessWidget {
|
|||||||
Container(
|
Container(
|
||||||
width: 45 * _deviceBlockSize,
|
width: 45 * _deviceBlockSize,
|
||||||
child: Text(
|
child: Text(
|
||||||
datas['accepted'] == 'Accepted' ||
|
datas['accepted'] == 'Accepted' &&
|
||||||
datas['verified'] == 'Verified'
|
datas['verified'] == 'Verified'
|
||||||
? 'Accepted'
|
? 'Accepted'
|
||||||
: 'Rejected',
|
: datas['accepted'] == 'Not Accepted' &&
|
||||||
|
datas['verified'] == 'NotVerified'
|
||||||
|
? 'Rejected'
|
||||||
|
: 'Pending..',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
color: datas['accepted'] == 'Accepted'
|
color: datas['accepted'] == 'Accepted' &&
|
||||||
|
datas['verified'] == 'Verified'
|
||||||
? kLightBlue
|
? kLightBlue
|
||||||
: kPink,
|
: datas['accepted'] == 'Not Accepted' &&
|
||||||
|
datas['verified'] == 'NotVerified'
|
||||||
|
? kPink
|
||||||
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.clip,
|
overflow: TextOverflow.clip,
|
||||||
),
|
),
|
||||||
@@ -240,26 +265,26 @@ class DatasBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if(datas['files'].isNotEmpty) Divider(),
|
if (datas['files'].isNotEmpty) Divider(),
|
||||||
if(datas['files'].isNotEmpty) SizedBox(
|
if (datas['files'].isNotEmpty)
|
||||||
|
SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
if(datas['files'].isNotEmpty) Container(
|
if (datas['files'].isNotEmpty)
|
||||||
|
Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
||||||
child: CarouselSlider.builder(
|
child: CarouselSlider.builder(
|
||||||
disableGesture: true,
|
disableGesture: true,
|
||||||
itemBuilder: (ctx, index, realIndex) {
|
itemBuilder: (ctx, index, realIndex) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
child: Image(
|
child:
|
||||||
image: NetworkImage(datas['files'][index])
|
Image(image: NetworkImage(datas['files'][index])),
|
||||||
),
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) => PinchZoom(
|
builder: (BuildContext context) => PinchZoom(
|
||||||
child: Image.network(datas['files'][index])
|
child: Image.network(datas['files'][index])),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -267,7 +292,7 @@ class DatasBox extends StatelessWidget {
|
|||||||
itemCount: datas['files'].length,
|
itemCount: datas['files'].length,
|
||||||
options: CarouselOptions(
|
options: CarouselOptions(
|
||||||
enlargeCenterPage: true,
|
enlargeCenterPage: true,
|
||||||
aspectRatio: 16/8,
|
aspectRatio: 16 / 8,
|
||||||
viewportFraction: datas['files'].length == 1 ? 1 : 0.6,
|
viewportFraction: datas['files'].length == 1 ? 1 : 0.6,
|
||||||
padEnds: false,
|
padEnds: false,
|
||||||
pauseAutoPlayOnTouch: true,
|
pauseAutoPlayOnTouch: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user