|
|
|
|
@ -22,80 +22,73 @@ class VisitItem extends StatelessWidget {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
UserProvider userProvider = Provider.of<UserProvider>(context);
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: ShapeDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
|
|
|
|
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 14, offset: Offset(0, 0), spreadRadius: 0)],
|
|
|
|
|
),
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
margin: EdgeInsets.only(bottom: 8.toScreenHeight),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
// StatusLabel(
|
|
|
|
|
// label: visit.priority.name,
|
|
|
|
|
// id: visit.priority.id,
|
|
|
|
|
// textColor: AColors.getPriorityStatusTextColor(visit.priority.id),
|
|
|
|
|
// backgroundColor: AColors.getPriorityStatusColor(visit.priority.id)),
|
|
|
|
|
// 8.width,
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: visit.status.name,
|
|
|
|
|
id: visit.status.id,
|
|
|
|
|
textColor: AColors.getRequestStatusTextColorByName(visit.status.name),
|
|
|
|
|
backgroundColor: AColors.getRequestStatusColorByName(visit.status.name),
|
|
|
|
|
),
|
|
|
|
|
1.width.expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(visit.deviceEnglishName, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.assetNumber}: ${visit.deviceNumber}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.assetSN}: ${visit.deviceSerialNumber}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.code}: ${visit.serialNumber}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
context.translation.viewDetails,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
|
|
|
|
|
),
|
|
|
|
|
4.width,
|
|
|
|
|
const Icon(Icons.arrow_forward, color: Color(0xFF4A8DB7), size: 14)
|
|
|
|
|
],
|
|
|
|
|
).onPress(() {
|
|
|
|
|
Navigator.of(context).push(MaterialPageRoute(builder: (_) => VisitDetailsPage(visit: visit)));
|
|
|
|
|
return Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
// StatusLabel(
|
|
|
|
|
// label: visit.priority.name,
|
|
|
|
|
// id: visit.priority.id,
|
|
|
|
|
// textColor: AColors.getPriorityStatusTextColor(visit.priority.id),
|
|
|
|
|
// backgroundColor: AColors.getPriorityStatusColor(visit.priority.id)),
|
|
|
|
|
// 8.width,
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: visit.status.name,
|
|
|
|
|
id: visit.status.id,
|
|
|
|
|
textColor: AColors.getRequestStatusTextColorByName(visit.status.name),
|
|
|
|
|
backgroundColor: AColors.getRequestStatusColorByName(visit.status.name),
|
|
|
|
|
),
|
|
|
|
|
1.width.expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(visit.deviceEnglishName, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.assetNumber}: ${visit.deviceNumber}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.assetSN}: ${visit.deviceSerialNumber}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.code}: ${visit.serialNumber}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
context.translation.viewDetails,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
|
|
|
|
|
),
|
|
|
|
|
4.width,
|
|
|
|
|
const Icon(Icons.arrow_forward, color: Color(0xFF4A8DB7), size: 14)
|
|
|
|
|
],
|
|
|
|
|
).onPress(() {
|
|
|
|
|
Navigator.of(context).push(MaterialPageRoute(builder: (_) => VisitDetailsPage(visit: visit)));
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
8.width,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
if (userProvider.user.type == UsersTypes.engineer && visit.status.id != 270)
|
|
|
|
|
"edit".toSvgAsset(height: 48, width: 48).onPress(() {
|
|
|
|
|
Navigator.of(context).push(MaterialPageRoute(builder: (_) => EditPentry(visit: visit, pentry: visit.pentry)));
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
8.width,
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
if (userProvider.user.type == UsersTypes.engineer && visit.status.value != 5 && visit.status.value != 3)
|
|
|
|
|
context.translation.edit.toSvgAsset(height: 48, width: 48).onPress(() {
|
|
|
|
|
Navigator.of(context).push(MaterialPageRoute(builder: (_) => EditPentry(visit: visit, pentry: visit.pentry)));
|
|
|
|
|
}),
|
|
|
|
|
Text(visit.createdOn != null ? visit.createdOn.toServiceRequestCardFormat : "", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
if (userProvider.user.type == UsersTypes.engineer && visit.status.id != 270) 8.height,
|
|
|
|
|
Text(visit.createdOn != null ? visit.createdOn.toServiceRequestCardFormat : "", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context).paddingOnly(bottom: 8);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|