mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-12 13:58:56 +03:30
Fix test result status
This commit is contained in:
@@ -29,6 +29,7 @@ class _TestResultScreenState extends State<TestResultScreen> {
|
||||
ScrollController? sc;
|
||||
|
||||
bool _isInit = true;
|
||||
|
||||
// List<TestResult> _data = [];
|
||||
|
||||
@override
|
||||
@@ -82,7 +83,12 @@ class _TestResultScreenState extends State<TestResultScreen> {
|
||||
TestResultFloatingButton(deviceBlockSize: _deviceBlockSize),
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('Home', style: TextStyle(color: Colors.white,),),
|
||||
title: Text(
|
||||
'Home',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
@@ -299,6 +305,7 @@ class _TestResultScreenState extends State<TestResultScreen> {
|
||||
|
||||
class TestItemBox extends StatelessWidget {
|
||||
final TestResultObject? item;
|
||||
|
||||
const TestItemBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
@@ -347,19 +354,28 @@ class TestItemBox extends StatelessWidget {
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
item!.result == 'Accepted'
|
||||
(item!.verified == 'NotVerified' &&
|
||||
item!.result == 'Not Accepted')
|
||||
? Text(
|
||||
'Accepted',
|
||||
style: TextStyle(
|
||||
color: kLightBlue,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'Rejected',
|
||||
style: TextStyle(
|
||||
color: kPink,
|
||||
),
|
||||
),
|
||||
)
|
||||
: (item!.verified == 'Verified' &&
|
||||
item!.result == 'Accepted')
|
||||
? Text(
|
||||
'Accepted',
|
||||
style: TextStyle(
|
||||
color: kLightBlue,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'Pending..',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
@@ -373,9 +389,11 @@ class TestItemBox extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
(userData['roles']?.contains('User') &&
|
||||
item!.verified != 'verified' &&
|
||||
item!.hospital
|
||||
.contains(userData['medical_center']))
|
||||
? InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
@@ -412,7 +430,89 @@ class TestItemBox extends StatelessWidget {
|
||||
size: 5 * _deviceBlockSize,
|
||||
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(
|
||||
width: 7.5,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user