You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
4.8 KiB
Dart
93 lines
4.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
import 'package:test_sa/extensions/string_extensions.dart';
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
import 'package:test_sa/models/visits/visit.dart';
|
|
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
|
import 'package:test_sa/views/pages/user/visits/pantry/edit_pentry.dart';
|
|
|
|
import '../../../../controllers/providers/api/user_provider.dart';
|
|
import '../../../../models/enums/user_types.dart';
|
|
import '../../../../new_views/common_widgets/app_filled_button.dart';
|
|
import '../../../app_style/colors.dart';
|
|
import '../../../widgets/requests/request_status.dart';
|
|
|
|
class VisitDetailsPage extends StatelessWidget {
|
|
static const String id = "/visit-details";
|
|
final Visit visit;
|
|
|
|
const VisitDetailsPage({Key key, this.visit}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
UserProvider userProvider = Provider.of<UserProvider>(context);
|
|
|
|
return Scaffold(
|
|
appBar: DefaultAppBar(title: context.translation.preventiveMaintenance),
|
|
body: SafeArea(
|
|
child: Column(
|
|
children: [
|
|
SingleChildScrollView(
|
|
child: Container(
|
|
margin: const EdgeInsets.all(16),
|
|
width: double.infinity,
|
|
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)],
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
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.getRequestStatusTextColor(visit.status.value),
|
|
backgroundColor: AColors.getRequestStatusColor(visit.status.value),
|
|
),
|
|
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('Asset Serial No.: ${visit.deviceSerialNumber}', style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575))),
|
|
Text('Code: ${visit.serialNumber}', style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575))),
|
|
const Divider().defaultStyle(context),
|
|
Text('Expected Date: ${visit.expectDate?.toServiceRequestDetailsFormat}', style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575))),
|
|
Text('Actual Date: ${visit.actualDate?.toServiceRequestDetailsFormat}', style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575))),
|
|
const Divider().defaultStyle(context),
|
|
Text('Assigned to: ${visit.assignTo}', style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575))),
|
|
Text('Engineer Name: ${visit.employName}', style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575))),
|
|
Text('Site: ${visit.hospitalName}', style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575))),
|
|
],
|
|
).paddingAll(16),
|
|
),
|
|
).expanded,
|
|
if (userProvider.user.type == UsersTypes.engineer && visit.status.value != 5 && visit.status.value != 3)
|
|
AppFilledButton(
|
|
onPressed: () {
|
|
Navigator.of(context).push(MaterialPageRoute(builder: (_) => EditPentry(visit: visit, pentry: visit.pentry)));
|
|
},
|
|
label: context.translation.updateRequest,
|
|
).paddingAll(16),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|