mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-14 00:28:57 +03:30
Set repair to my items and fix colors of items in result
This commit is contained in:
@@ -164,12 +164,13 @@ class Url {
|
|||||||
static String changeItemStatus(String id) {
|
static String changeItemStatus(String id) {
|
||||||
return '$baseUrl/Items/ChangeStatus/$id';
|
return '$baseUrl/Items/ChangeStatus/$id';
|
||||||
}
|
}
|
||||||
|
|
||||||
static String changePackageStatus(String id) {
|
static String changePackageStatus(String id) {
|
||||||
return '$baseUrl/Packages/ChangeStatus/$id';
|
return '$baseUrl/Packages/ChangeStatus/$id';
|
||||||
}
|
}
|
||||||
|
|
||||||
static String repairItems(String id) {
|
static String repairItems(String id) {
|
||||||
return '$baseUrl/transfer-items/ChangeRepair/$id';
|
return '$baseUrl/Items/ChangeRepair/$id';
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getUsers(String id) {
|
static String getUsers(String id) {
|
||||||
|
|||||||
+16
-15
@@ -55,22 +55,23 @@ class ItemDetailObject extends Equatable {
|
|||||||
final String status;
|
final String status;
|
||||||
final List<String>? filePath;
|
final List<String>? filePath;
|
||||||
final String? packageId;
|
final String? packageId;
|
||||||
|
final int? repair;
|
||||||
|
|
||||||
ItemDetailObject({
|
ItemDetailObject(
|
||||||
required this.id,
|
{required this.id,
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.userName,
|
required this.userName,
|
||||||
required this.size,
|
required this.size,
|
||||||
required this.specific,
|
required this.specific,
|
||||||
required this.hospital,
|
required this.hospital,
|
||||||
required this.description,
|
required this.description,
|
||||||
required this.createdAt,
|
required this.createdAt,
|
||||||
required this.udi,
|
required this.udi,
|
||||||
required this.status,
|
required this.status,
|
||||||
this.filePath,
|
this.filePath,
|
||||||
required this.packageId,
|
required this.packageId,
|
||||||
required this.userCreator,
|
required this.userCreator,
|
||||||
});
|
this.repair});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props {
|
List<Object> get props {
|
||||||
|
|||||||
@@ -373,6 +373,7 @@ class ItemProvider extends ChangeNotifier {
|
|||||||
udi: data['udi'] != null ? data['udi'] : '',
|
udi: data['udi'] != null ? data['udi'] : '',
|
||||||
status: data['status'],
|
status: data['status'],
|
||||||
packageId: data['package_id'].toString(),
|
packageId: data['package_id'].toString(),
|
||||||
|
repair: data['repair'],
|
||||||
filePath: mediaList,
|
filePath: mediaList,
|
||||||
);
|
);
|
||||||
return result!;
|
return result!;
|
||||||
|
|||||||
@@ -287,18 +287,11 @@ class MyItemProvider extends ChangeNotifier {
|
|||||||
print(itemData);
|
print(itemData);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> repairItems(String itemId, String value) async {
|
Future<void> repairItems(String itemId) async {
|
||||||
var response = await http.post(
|
var response = await http.post(
|
||||||
Uri.parse(Url.repairItems(itemId)),
|
Uri.parse(Url.repairItems(itemId)),
|
||||||
body: json.encode(
|
|
||||||
{
|
|
||||||
'status': value,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': User.token,
|
'Authorization': User.token,
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Accept": "application/json"
|
"Accept": "application/json"
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,14 +6,12 @@ import 'package:intl/intl.dart';
|
|||||||
import 'package:pinch_zoom/pinch_zoom.dart';
|
import 'package:pinch_zoom/pinch_zoom.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
|
||||||
class ItemDetailsDataBox extends StatelessWidget {
|
class ItemDetailsDataBox extends StatelessWidget {
|
||||||
const ItemDetailsDataBox({
|
const ItemDetailsDataBox({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.datas,
|
required this.datas,
|
||||||
required double deviceBlockSize,
|
required double deviceBlockSize,
|
||||||
})
|
}) : _deviceBlockSize = deviceBlockSize,
|
||||||
: _deviceBlockSize = deviceBlockSize,
|
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|
||||||
final ItemDetailObject datas;
|
final ItemDetailObject datas;
|
||||||
@@ -46,7 +44,11 @@ class ItemDetailsDataBox extends StatelessWidget {
|
|||||||
color: Color.fromRGBO(235, 235, 235, 1),
|
color: Color.fromRGBO(235, 235, 235, 1),
|
||||||
border: Border(
|
border: Border(
|
||||||
left: BorderSide(
|
left: BorderSide(
|
||||||
color: kBlue,
|
color: datas.status == 'approved'
|
||||||
|
? kBlue
|
||||||
|
: datas.status == 'rejected'
|
||||||
|
? kPink
|
||||||
|
: Colors.grey,
|
||||||
width: 2,
|
width: 2,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -62,14 +64,22 @@ class ItemDetailsDataBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: kBlue,
|
color: datas.status == 'approved'
|
||||||
|
? kBlue
|
||||||
|
: datas.status == 'rejected'
|
||||||
|
? kPink
|
||||||
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Divider(),
|
Divider(),
|
||||||
Text(
|
Text(
|
||||||
'ID: ${datas.id}',
|
'ID: ${datas.id}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: kBlue,
|
color: datas.status == 'approved'
|
||||||
|
? kBlue
|
||||||
|
: datas.status == 'rejected'
|
||||||
|
? kPink
|
||||||
|
: Colors.grey,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -337,14 +347,18 @@ class ItemDetailsDataBox extends StatelessWidget {
|
|||||||
Container(
|
Container(
|
||||||
width: 45 * _deviceBlockSize,
|
width: 45 * _deviceBlockSize,
|
||||||
child: Text(
|
child: Text(
|
||||||
datas.status == 'approved' ? 'Confirmed' :
|
datas.status == 'approved'
|
||||||
datas
|
? 'Confirmed'
|
||||||
.status == 'rejected' ? 'Rejected' : 'Pending..',
|
: datas.status == 'rejected'
|
||||||
|
? 'Rejected'
|
||||||
|
: 'Pending..',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
color: datas.status == 'approved' ? kBlue :
|
color: datas.status == 'approved'
|
||||||
datas
|
? kBlue
|
||||||
.status == 'rejected' ? kPink : Colors.grey,
|
: datas.status == 'rejected'
|
||||||
|
? kPink
|
||||||
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.clip,
|
overflow: TextOverflow.clip,
|
||||||
),
|
),
|
||||||
@@ -365,16 +379,12 @@ class ItemDetailsDataBox extends StatelessWidget {
|
|||||||
itemBuilder: (ctx, index, realIndex) {
|
itemBuilder: (ctx, index, realIndex) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
child: Image(
|
child: Image(
|
||||||
image: NetworkImage(datas.filePath![index])
|
image: NetworkImage(datas.filePath![index])),
|
||||||
),
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) =>
|
builder: (BuildContext context) => PinchZoom(
|
||||||
PinchZoom(
|
child: Image.network(datas.filePath![index])),
|
||||||
child: Image.network(
|
|
||||||
datas.filePath![index])
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -390,7 +400,7 @@ class ItemDetailsDataBox extends StatelessWidget {
|
|||||||
autoPlay: false,
|
autoPlay: false,
|
||||||
enlargeFactor: 0.5,
|
enlargeFactor: 0.5,
|
||||||
enableInfiniteScroll:
|
enableInfiniteScroll:
|
||||||
datas.filePath?.length == 1 ? false : true,
|
datas.filePath?.length == 1 ? false : true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -401,8 +411,7 @@ class ItemDetailsDataBox extends StatelessWidget {
|
|||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async =>
|
onTap: () async => await launch(
|
||||||
await launch(
|
|
||||||
'https://cssd-doc.com/Show/Item/${datas.id.toString()}',
|
'https://cssd-doc.com/Show/Item/${datas.id.toString()}',
|
||||||
),
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|||||||
@@ -55,7 +55,13 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
|||||||
color: Color.fromRGBO(235, 235, 235, 1),
|
color: Color.fromRGBO(235, 235, 235, 1),
|
||||||
border: Border(
|
border: Border(
|
||||||
left: BorderSide(
|
left: BorderSide(
|
||||||
color: kDarkBlue,
|
color: datas.repair == 1
|
||||||
|
? kPink
|
||||||
|
: datas.status == 'approved'
|
||||||
|
? kDarkBlue
|
||||||
|
: datas.status == 'rejected'
|
||||||
|
? kPink
|
||||||
|
: Colors.grey,
|
||||||
width: 2,
|
width: 2,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -71,14 +77,26 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: kDarkBlue,
|
color: datas.repair == 1
|
||||||
|
? kPink
|
||||||
|
: datas.status == 'approved'
|
||||||
|
? kDarkBlue
|
||||||
|
: datas.status == 'rejected'
|
||||||
|
? kPink
|
||||||
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Divider(),
|
Divider(),
|
||||||
Text(
|
Text(
|
||||||
'ID: ${datas.id}',
|
'ID: ${datas.id}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: kDarkBlue,
|
color: datas.repair == 1
|
||||||
|
? kPink
|
||||||
|
: datas.status == 'approved'
|
||||||
|
? kDarkBlue
|
||||||
|
: datas.status == 'rejected'
|
||||||
|
? kPink
|
||||||
|
: Colors.grey,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -346,10 +364,22 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
|||||||
Container(
|
Container(
|
||||||
width: 45 * _deviceBlockSize,
|
width: 45 * _deviceBlockSize,
|
||||||
child: Text(
|
child: Text(
|
||||||
datas.status == 'approved' ? 'Success' : 'Failure',
|
datas.repair == 1
|
||||||
|
? 'Pending...'
|
||||||
|
: datas.status == 'approved'
|
||||||
|
? 'Success'
|
||||||
|
: datas.status == 'rejected'
|
||||||
|
? 'Failure'
|
||||||
|
: 'Pending...',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
color: datas.status == 'approved' ? kDarkBlue : kPink,
|
color: datas.repair == 1
|
||||||
|
? kPink
|
||||||
|
: datas.status == 'approved'
|
||||||
|
? kDarkBlue
|
||||||
|
: datas.status == 'rejected'
|
||||||
|
? kPink
|
||||||
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.clip,
|
overflow: TextOverflow.clip,
|
||||||
),
|
),
|
||||||
@@ -647,7 +677,7 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
|||||||
await Provider.of<MyItemProvider>(
|
await Provider.of<MyItemProvider>(
|
||||||
context,
|
context,
|
||||||
listen: false)
|
listen: false)
|
||||||
.repairItems(datas.id, 'suspended')
|
.repairItems(datas.id)
|
||||||
.then(
|
.then(
|
||||||
(value) {
|
(value) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
@@ -726,8 +756,7 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Provider.of<MyItemProvider>(context,
|
Provider.of<MyItemProvider>(context,
|
||||||
listen: false)
|
listen: false)
|
||||||
.repairItems(
|
.repairItems(datas.id)
|
||||||
datas.id, 'suspended')
|
|
||||||
.then(
|
.then(
|
||||||
(value) {
|
(value) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
|||||||
Reference in New Issue
Block a user