mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 23:08:56 +03:30
Change some ui in package result
This commit is contained in:
@@ -6,12 +6,14 @@ class PackageResultObject extends Equatable {
|
|||||||
final String createdAt;
|
final String createdAt;
|
||||||
final String name;
|
final String name;
|
||||||
final String status;
|
final String status;
|
||||||
|
final String userName;
|
||||||
|
|
||||||
PackageResultObject({
|
PackageResultObject({
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.createdAt,
|
required this.createdAt,
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.status
|
required this.status,
|
||||||
|
required this.userName,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -31,14 +33,15 @@ class PackageDetailObject extends Equatable {
|
|||||||
final String description;
|
final String description;
|
||||||
final String createDate;
|
final String createDate;
|
||||||
final String hospitalName;
|
final String hospitalName;
|
||||||
|
|
||||||
// final String udi;
|
// final String udi;
|
||||||
final List<String> items;
|
final List<String> items;
|
||||||
final String userName;
|
final String userName;
|
||||||
final String userCreator;
|
final String userCreator;
|
||||||
final String status;
|
final String status;
|
||||||
|
|
||||||
PackageDetailObject({
|
PackageDetailObject(
|
||||||
required this.id,
|
{required this.id,
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.description,
|
required this.description,
|
||||||
required this.createDate,
|
required this.createDate,
|
||||||
@@ -47,8 +50,7 @@ class PackageDetailObject extends Equatable {
|
|||||||
required this.items,
|
required this.items,
|
||||||
required this.userName,
|
required this.userName,
|
||||||
required this.userCreator,
|
required this.userCreator,
|
||||||
required this.status
|
required this.status});
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props {
|
List<Object> get props {
|
||||||
@@ -73,6 +75,7 @@ class PackageFilterObject extends Equatable {
|
|||||||
final String id;
|
final String id;
|
||||||
final String name;
|
final String name;
|
||||||
final String hospital;
|
final String hospital;
|
||||||
|
|
||||||
// final String udi;
|
// final String udi;
|
||||||
|
|
||||||
PackageFilterObject({
|
PackageFilterObject({
|
||||||
|
|||||||
@@ -401,7 +401,8 @@ class PackageProvider extends ChangeNotifier {
|
|||||||
createdAt: item['created_at'],
|
createdAt: item['created_at'],
|
||||||
id: item['id'].toString(),
|
id: item['id'].toString(),
|
||||||
name: item['name'],
|
name: item['name'],
|
||||||
status: item['status']),
|
status: item['status'],
|
||||||
|
userName: item['user']['name']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
pageNumber += 1;
|
pageNumber += 1;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:cssd/providers/auth.dart';
|
|||||||
import 'package:cssd/providers/packages.dart';
|
import 'package:cssd/providers/packages.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@@ -54,19 +53,11 @@ class PackageItemBox extends StatelessWidget {
|
|||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
|
||||||
width: 30 * _deviceBlockSize,
|
|
||||||
child: Text(
|
|
||||||
item!.id,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 3 * _deviceBlockSize,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
Container(
|
||||||
width: 40 * _deviceBlockSize,
|
width: 40 * _deviceBlockSize,
|
||||||
child: Text(
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
item!.name,
|
item!.name,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@@ -74,13 +65,78 @@ class PackageItemBox extends StatelessWidget {
|
|||||||
fontSize: 3 * _deviceBlockSize,
|
fontSize: 3 * _deviceBlockSize,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (item!.status != "approved")
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 5.0),
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
vertical: 1, horizontal: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: item!.status == "pending"
|
||||||
|
? Colors.grey.withOpacity(0.2)
|
||||||
|
: kPink.withOpacity(0.05),
|
||||||
|
borderRadius: BorderRadius.circular(2)),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
item!.status,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 2 * _deviceBlockSize,
|
||||||
|
color: item!.status == "pending"
|
||||||
|
? Colors.black.withOpacity(0.5)
|
||||||
|
: kPink,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 50 * _deviceBlockSize,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"ID: ",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
item!.id,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
color: Colors.black87,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
" | ",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Owner: ",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
item!.userName,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 3 * _deviceBlockSize,
|
||||||
|
color: Colors.black87,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
width: 30 * _deviceBlockSize,
|
width: 30 * _deviceBlockSize,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
'Date:',
|
'Items: ',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
fontSize: 3 * _deviceBlockSize,
|
fontSize: 3 * _deviceBlockSize,
|
||||||
@@ -134,6 +190,254 @@ class PackageItemBox extends StatelessWidget {
|
|||||||
: Row(
|
: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
if (userData['roles']?.contains('Admin') ||
|
||||||
|
userData['roles']
|
||||||
|
?.contains('Supervisor'))
|
||||||
|
item?.status == "pending"
|
||||||
|
? Row(
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
customBorder: CircleBorder(),
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(
|
||||||
|
'Are you Confirm this item?',
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
Consumer<
|
||||||
|
PackageProvider>(
|
||||||
|
builder: (context,
|
||||||
|
itemProvider,
|
||||||
|
_) {
|
||||||
|
return itemProvider
|
||||||
|
.isloadingButton
|
||||||
|
? CircularProgressIndicator(
|
||||||
|
color: Colors
|
||||||
|
.black,
|
||||||
|
)
|
||||||
|
: TextButton(
|
||||||
|
onPressed:
|
||||||
|
() async {
|
||||||
|
itemProvider
|
||||||
|
.setLoadingButton();
|
||||||
|
await Provider.of<PackageProvider>(context,
|
||||||
|
listen: false)
|
||||||
|
.changeStatus(item!.id, "approved")
|
||||||
|
.then(
|
||||||
|
(value) {
|
||||||
|
if (value) {
|
||||||
|
print('true');
|
||||||
|
}
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).popAndPushNamed(Routes.packageResultScreen);
|
||||||
|
Fluttertoast.showToast(
|
||||||
|
msg: "Package is Approved.",
|
||||||
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
|
gravity: ToastGravity.BOTTOM,
|
||||||
|
);
|
||||||
|
itemProvider.resetLoadingButton();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Yes'),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(
|
||||||
|
context)
|
||||||
|
.pop();
|
||||||
|
},
|
||||||
|
child: Text('No'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(7),
|
||||||
|
width: 8 * _deviceBlockSize,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: kLightBlue,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.check,
|
||||||
|
size:
|
||||||
|
4 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 5.0,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
customBorder: CircleBorder(),
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(
|
||||||
|
'Are you Reject this Package?'),
|
||||||
|
actions: <Widget>[
|
||||||
|
Consumer<
|
||||||
|
PackageProvider>(
|
||||||
|
builder: (context,
|
||||||
|
itemProvider,
|
||||||
|
_) {
|
||||||
|
return itemProvider
|
||||||
|
.isloadingButton
|
||||||
|
? CircularProgressIndicator(
|
||||||
|
color: Colors
|
||||||
|
.black,
|
||||||
|
)
|
||||||
|
: TextButton(
|
||||||
|
onPressed:
|
||||||
|
() async {
|
||||||
|
itemProvider
|
||||||
|
.setLoadingButton();
|
||||||
|
await Provider.of<PackageProvider>(context, listen: false)
|
||||||
|
.changeStatus(item!.id, "rejected")
|
||||||
|
.then(
|
||||||
|
(value) {
|
||||||
|
if (value) {
|
||||||
|
print('true');
|
||||||
|
}
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).popAndPushNamed(Routes.packageResultScreen);
|
||||||
|
Fluttertoast.showToast(
|
||||||
|
msg: "Package is rejected.",
|
||||||
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
|
gravity: ToastGravity.BOTTOM,
|
||||||
|
);
|
||||||
|
itemProvider.resetLoadingButton();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Yes'),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(
|
||||||
|
context)
|
||||||
|
.pop();
|
||||||
|
},
|
||||||
|
child: Text('No'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(7),
|
||||||
|
width: 8 * _deviceBlockSize,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black),
|
||||||
|
child: Icon(
|
||||||
|
Icons.close,
|
||||||
|
size:
|
||||||
|
4 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: item?.status == "rejected"
|
||||||
|
? InkWell(
|
||||||
|
customBorder: CircleBorder(),
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(
|
||||||
|
'Are you Confirm this Package?',
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
Consumer<
|
||||||
|
PackageProvider>(
|
||||||
|
builder: (context,
|
||||||
|
itemProvider,
|
||||||
|
_) {
|
||||||
|
return itemProvider
|
||||||
|
.isloadingButton
|
||||||
|
? CircularProgressIndicator(
|
||||||
|
color: Colors
|
||||||
|
.black,
|
||||||
|
)
|
||||||
|
: TextButton(
|
||||||
|
onPressed:
|
||||||
|
() async {
|
||||||
|
itemProvider
|
||||||
|
.setLoadingButton();
|
||||||
|
await Provider.of<PackageProvider>(context,
|
||||||
|
listen: false)
|
||||||
|
.changeStatus(item!.id, "approved")
|
||||||
|
.then(
|
||||||
|
(value) {
|
||||||
|
if (value) {
|
||||||
|
print('true');
|
||||||
|
}
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).popAndPushNamed(Routes.packageResultScreen);
|
||||||
|
Fluttertoast.showToast(
|
||||||
|
msg: "Package is Approved.",
|
||||||
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
|
gravity: ToastGravity.BOTTOM,
|
||||||
|
);
|
||||||
|
itemProvider.resetLoadingButton();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Yes'),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(
|
||||||
|
context)
|
||||||
|
.pop();
|
||||||
|
},
|
||||||
|
child: Text('No'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(7),
|
||||||
|
width: 8 * _deviceBlockSize,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: kLightBlue,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.check,
|
||||||
|
size:
|
||||||
|
4 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
SizedBox(
|
||||||
|
width: 5.0,
|
||||||
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
customBorder: CircleBorder(),
|
customBorder: CircleBorder(),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|||||||
Reference in New Issue
Block a user