|
|
|
|
@ -39,59 +39,58 @@ class IncidentDetailPage extends StatelessWidget {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: const DefaultAppBar(title: "Request Details"),
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
child: FutureBuilder<IncidentDataModel?>(
|
|
|
|
|
future: Provider.of<IncidentProvider>(context, listen: false).getIncidentById(incidentId),
|
|
|
|
|
builder: (BuildContext context, AsyncSnapshot<IncidentDataModel?> snapshot) {
|
|
|
|
|
if (snapshot.connectionState == ConnectionState.waiting) return const CircularProgressIndicator(color: AppColor.primary10).center;
|
|
|
|
|
if (snapshot.data == null) return const NoDataFound().center;
|
|
|
|
|
|
|
|
|
|
List<IncidentAttachments> allAttachments = snapshot.data!.incidentAttachments!;
|
|
|
|
|
|
|
|
|
|
return ListView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: snapshot.data!.incidentStatusName!,
|
|
|
|
|
textColor: AppColor.getRequestStatusTextColorByName(context, snapshot.data!.incidentStatusName!),
|
|
|
|
|
backgroundColor: AppColor.getRequestStatusColorByName(context, snapshot.data!.incidentStatusName!),
|
|
|
|
|
),
|
|
|
|
|
1.width.expanded,
|
|
|
|
|
Text(
|
|
|
|
|
snapshot.data!.createdDate?.toServiceRequestCardFormat ?? "-",
|
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
...requesterDetails(context, snapshot.data!),
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
...requestDetails(context, snapshot.data!),
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
...assetDetails(context, snapshot.data!),
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
...personInvolvedDetails(context, snapshot.data!),
|
|
|
|
|
if (allAttachments.isNotEmpty) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
body: FutureBuilder<IncidentDataModel?>(
|
|
|
|
|
future: Provider.of<IncidentProvider>(context, listen: false).getIncidentById(incidentId),
|
|
|
|
|
builder: (BuildContext context, AsyncSnapshot<IncidentDataModel?> snapshot) {
|
|
|
|
|
if (snapshot.connectionState == ConnectionState.waiting) return const CircularProgressIndicator(color: AppColor.primary10).center;
|
|
|
|
|
if (snapshot.data == null) return const NoDataFound().center;
|
|
|
|
|
|
|
|
|
|
List<IncidentAttachments> allAttachments = snapshot.data!.incidentAttachments!;
|
|
|
|
|
|
|
|
|
|
return ListView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: snapshot.data!.incidentStatusName!,
|
|
|
|
|
textColor: AppColor.getRequestStatusTextColorByName(context, snapshot.data!.incidentStatusName!),
|
|
|
|
|
backgroundColor: AppColor.getRequestStatusColorByName(context, snapshot.data!.incidentStatusName!),
|
|
|
|
|
),
|
|
|
|
|
1.width.expanded,
|
|
|
|
|
Text(
|
|
|
|
|
"Attachments".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
snapshot.data!.createdDate?.toServiceRequestCardFormat ?? "-",
|
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
...requesterDetails(context, snapshot.data!),
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
...requestDetails(context, snapshot.data!),
|
|
|
|
|
if (snapshot.data!.ovrTicketNumber?.isNotEmpty ?? false) ovrInformation(context, snapshot.data!.ovrTicketNumber!),
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
...assetDetails(context, snapshot.data!),
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
...personInvolvedDetails(context, snapshot.data!),
|
|
|
|
|
if (allAttachments.isNotEmpty) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
Text(
|
|
|
|
|
"Attachments".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context, padding: 12),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
));
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context, padding: 12),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Widget> requestDetails(BuildContext context, IncidentDataModel incidentData) {
|
|
|
|
|
@ -113,6 +112,29 @@ class IncidentDetailPage extends StatelessWidget {
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget ovrInformation(BuildContext context, String ovrNumber) {
|
|
|
|
|
return FutureBuilder<Map<String, dynamic>?>(
|
|
|
|
|
future: Provider.of<IncidentProvider>(context, listen: false).getOvrTicketDetails(ovrNumber),
|
|
|
|
|
builder: (BuildContext context, AsyncSnapshot<Map<String, dynamic>?> snapshot) {
|
|
|
|
|
if (snapshot.connectionState == ConnectionState.waiting) return const CircularProgressIndicator(color: AppColor.primary10).center;
|
|
|
|
|
if (snapshot.data == null) return const NoDataFound().center;
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic>? data = snapshot.data;
|
|
|
|
|
if (data == null) return const SizedBox();
|
|
|
|
|
List<String> keysList = data.keys.toList();
|
|
|
|
|
return Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
Text("OVR Ticket Information", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
|
|
|
|
|
'OVR Ticket Number: $ovrNumber'.bodyText(context),
|
|
|
|
|
for (int i = 0; i < keysList.length; i++) '${keysList[i]}: ${data[keysList[i]] ?? "-"}'.bodyText(context),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Widget> personInvolvedDetails(BuildContext context, IncidentDataModel incidentData) {
|
|
|
|
|
return [
|
|
|
|
|
Text("Person Involved Information", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
|
|
|
|
|
|