mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 20:18:54 +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,
|
||||
),
|
||||
|
||||
@@ -359,6 +359,7 @@ class TestResultsProvider with ChangeNotifier {
|
||||
.firstWhere((element) => element.id == data['id'].toString())
|
||||
.hospital, // az api safheye asli estefade mi shavad
|
||||
'files': mediaList,
|
||||
'verified' : data['verified']
|
||||
};
|
||||
return result!;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,13 @@ class DatasBox extends StatelessWidget {
|
||||
color: Color.fromRGBO(230, 230, 230, 1),
|
||||
border: Border(
|
||||
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,
|
||||
),
|
||||
),
|
||||
@@ -58,14 +64,26 @@ class DatasBox extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
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(),
|
||||
Text(
|
||||
datas['test_type_name'],
|
||||
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,
|
||||
),
|
||||
),
|
||||
@@ -198,15 +216,22 @@ class DatasBox extends StatelessWidget {
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['accepted'] == 'Accepted' ||
|
||||
datas['accepted'] == 'Accepted' &&
|
||||
datas['verified'] == 'Verified'
|
||||
? 'Accepted'
|
||||
: 'Rejected',
|
||||
: datas['accepted'] == 'Not Accepted' &&
|
||||
datas['verified'] == 'NotVerified'
|
||||
? 'Rejected'
|
||||
: 'Pending..',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: datas['accepted'] == 'Accepted'
|
||||
color: datas['accepted'] == 'Accepted' &&
|
||||
datas['verified'] == 'Verified'
|
||||
? kLightBlue
|
||||
: kPink,
|
||||
: datas['accepted'] == 'Not Accepted' &&
|
||||
datas['verified'] == 'NotVerified'
|
||||
? kPink
|
||||
: Colors.grey,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
@@ -240,45 +265,45 @@ class DatasBox extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
if(datas['files'].isNotEmpty) Divider(),
|
||||
if(datas['files'].isNotEmpty) SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
if(datas['files'].isNotEmpty) Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
||||
child: CarouselSlider.builder(
|
||||
disableGesture: true,
|
||||
itemBuilder: (ctx, index, realIndex) {
|
||||
return InkWell(
|
||||
child: Image(
|
||||
image: NetworkImage(datas['files'][index])
|
||||
),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) => PinchZoom(
|
||||
child: Image.network(datas['files'][index])
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
itemCount: datas['files'].length,
|
||||
options: CarouselOptions(
|
||||
enlargeCenterPage: true,
|
||||
aspectRatio: 16/8,
|
||||
viewportFraction: datas['files'].length == 1 ? 1 : 0.6,
|
||||
padEnds: false,
|
||||
pauseAutoPlayOnTouch: true,
|
||||
disableCenter: false,
|
||||
autoPlay: false,
|
||||
enlargeFactor: 0.5,
|
||||
enableInfiniteScroll:
|
||||
datas['files'].length == 1 ? false : true,
|
||||
if (datas['files'].isNotEmpty) Divider(),
|
||||
if (datas['files'].isNotEmpty)
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
if (datas['files'].isNotEmpty)
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
||||
child: CarouselSlider.builder(
|
||||
disableGesture: true,
|
||||
itemBuilder: (ctx, index, realIndex) {
|
||||
return InkWell(
|
||||
child:
|
||||
Image(image: NetworkImage(datas['files'][index])),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) => PinchZoom(
|
||||
child: Image.network(datas['files'][index])),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
itemCount: datas['files'].length,
|
||||
options: CarouselOptions(
|
||||
enlargeCenterPage: true,
|
||||
aspectRatio: 16 / 8,
|
||||
viewportFraction: datas['files'].length == 1 ? 1 : 0.6,
|
||||
padEnds: false,
|
||||
pauseAutoPlayOnTouch: true,
|
||||
disableCenter: false,
|
||||
autoPlay: false,
|
||||
enlargeFactor: 0.5,
|
||||
enableInfiniteScroll:
|
||||
datas['files'].length == 1 ? false : true,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user