incident detail page addded.
parent
cb2329a6c2
commit
6cf051e66e
@ -0,0 +1,313 @@
|
||||
import 'package:test_sa/modules/incident_module/incident_attachment_model.dart';
|
||||
|
||||
class IncidentDataModel {
|
||||
int? id;
|
||||
int? reqNo;
|
||||
String? reqCode;
|
||||
int? incidentStatusId;
|
||||
String? incidentStatusName;
|
||||
int? incidentStatusValue;
|
||||
int? incidentClassificationId;
|
||||
String? incidentClassificationName;
|
||||
int? incidentClassificationValue;
|
||||
int? existingOvrTicketId;
|
||||
String? existingOvrTicketName;
|
||||
int? existingOvrTicketValue;
|
||||
String? ovrTicketNumber;
|
||||
String? incidentTitle;
|
||||
String? incidentDescription;
|
||||
int? assetId;
|
||||
String? assetNumber;
|
||||
String? oracleCode;
|
||||
String? model;
|
||||
String? manufacturer;
|
||||
String? assetOrigin;
|
||||
int? siteId;
|
||||
String? siteName;
|
||||
int? buildingId;
|
||||
String? buildingName;
|
||||
int? departmentId;
|
||||
String? departmentName;
|
||||
int? floorId;
|
||||
String? floorName;
|
||||
int? rootCauseId;
|
||||
String? rootCauseName;
|
||||
int? rootCauseValue;
|
||||
String? otherRootCause;
|
||||
String? comments;
|
||||
int? personInvolvedId;
|
||||
String? personInvolvedName;
|
||||
int? personInvolvedValue;
|
||||
int? genderId;
|
||||
String? genderName;
|
||||
int? personInvolvedEmployeeId;
|
||||
String? personInvolvedEmployeeName;
|
||||
String? assignedQAId;
|
||||
String? assignedQAName;
|
||||
String? assignedSecondaryQAId;
|
||||
String? assignedSecondaryQAName;
|
||||
String? qaLeaderId;
|
||||
String? qaLeaderName;
|
||||
String? correctiveAction;
|
||||
int? escalateToOvrId;
|
||||
String? escalateToOvrName;
|
||||
int? immediateActionId;
|
||||
String? immediateActionName;
|
||||
int? clinicalOrNonClinicalId;
|
||||
String? clinicalOrNonClinicalName;
|
||||
String? recommendation;
|
||||
String? requestorUserId;
|
||||
String? requesterEmployeeId;
|
||||
String? requesterEmployeeName;
|
||||
String? requesterEmployeeEmail;
|
||||
String? requesterPosition;
|
||||
String? requesterContactNo;
|
||||
String? requesterExtensionNo;
|
||||
int? requestorSiteId;
|
||||
String? requestorSiteName;
|
||||
int? requestorDepartmentId;
|
||||
String? requestorDepartmentName;
|
||||
int? requestorFlowDepartmentId;
|
||||
String? requestorFlowDepartmentName;
|
||||
String? requestorFlowDepartmentShortCode;
|
||||
String? approvalSignature;
|
||||
String? occurrenceDate;
|
||||
String? createdDate;
|
||||
List<IncidentAttachments>? incidentAttachments;
|
||||
|
||||
IncidentDataModel(
|
||||
{this.id,
|
||||
this.reqNo,
|
||||
this.reqCode,
|
||||
this.incidentStatusId,
|
||||
this.incidentStatusName,
|
||||
this.incidentStatusValue,
|
||||
this.incidentClassificationId,
|
||||
this.incidentClassificationName,
|
||||
this.incidentClassificationValue,
|
||||
this.existingOvrTicketId,
|
||||
this.existingOvrTicketName,
|
||||
this.existingOvrTicketValue,
|
||||
this.ovrTicketNumber,
|
||||
this.incidentTitle,
|
||||
this.incidentDescription,
|
||||
this.assetId,
|
||||
this.assetNumber,
|
||||
this.oracleCode,
|
||||
this.model,
|
||||
this.manufacturer,
|
||||
this.assetOrigin,
|
||||
this.siteId,
|
||||
this.siteName,
|
||||
this.buildingId,
|
||||
this.buildingName,
|
||||
this.departmentId,
|
||||
this.departmentName,
|
||||
this.floorId,
|
||||
this.floorName,
|
||||
this.rootCauseId,
|
||||
this.rootCauseName,
|
||||
this.rootCauseValue,
|
||||
this.otherRootCause,
|
||||
this.comments,
|
||||
this.personInvolvedId,
|
||||
this.personInvolvedName,
|
||||
this.personInvolvedValue,
|
||||
this.genderId,
|
||||
this.genderName,
|
||||
this.personInvolvedEmployeeId,
|
||||
this.personInvolvedEmployeeName,
|
||||
this.assignedQAId,
|
||||
this.assignedQAName,
|
||||
this.assignedSecondaryQAId,
|
||||
this.assignedSecondaryQAName,
|
||||
this.qaLeaderId,
|
||||
this.qaLeaderName,
|
||||
this.correctiveAction,
|
||||
this.escalateToOvrId,
|
||||
this.escalateToOvrName,
|
||||
this.immediateActionId,
|
||||
this.immediateActionName,
|
||||
this.clinicalOrNonClinicalId,
|
||||
this.clinicalOrNonClinicalName,
|
||||
this.recommendation,
|
||||
this.requestorUserId,
|
||||
this.requesterEmployeeId,
|
||||
this.requesterEmployeeName,
|
||||
this.requesterEmployeeEmail,
|
||||
this.requesterPosition,
|
||||
this.requesterContactNo,
|
||||
this.requesterExtensionNo,
|
||||
this.requestorSiteId,
|
||||
this.requestorSiteName,
|
||||
this.requestorDepartmentId,
|
||||
this.requestorDepartmentName,
|
||||
this.requestorFlowDepartmentId,
|
||||
this.requestorFlowDepartmentName,
|
||||
this.requestorFlowDepartmentShortCode,
|
||||
this.approvalSignature,
|
||||
this.occurrenceDate,
|
||||
this.createdDate,
|
||||
this.incidentAttachments});
|
||||
|
||||
IncidentDataModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
reqNo = json['reqNo'];
|
||||
reqCode = json['reqCode'];
|
||||
incidentStatusId = json['incidentStatusId'];
|
||||
incidentStatusName = json['incidentStatusName'];
|
||||
incidentStatusValue = json['incidentStatusValue'];
|
||||
incidentClassificationId = json['incidentClassificationId'];
|
||||
incidentClassificationName = json['incidentClassificationName'];
|
||||
incidentClassificationValue = json['incidentClassificationValue'];
|
||||
existingOvrTicketId = json['existingOvrTicketId'];
|
||||
existingOvrTicketName = json['existingOvrTicketName'];
|
||||
existingOvrTicketValue = json['existingOvrTicketValue'];
|
||||
ovrTicketNumber = json['ovrTicketNumber'];
|
||||
incidentTitle = json['incidentTitle'];
|
||||
incidentDescription = json['incidentDescription'];
|
||||
assetId = json['assetId'];
|
||||
assetNumber = json['assetNumber'];
|
||||
oracleCode = json['oracleCode'];
|
||||
model = json['model'];
|
||||
manufacturer = json['manufacturer'];
|
||||
assetOrigin = json['assetOrigin'];
|
||||
siteId = json['siteId'];
|
||||
siteName = json['siteName'];
|
||||
buildingId = json['buildingId'];
|
||||
buildingName = json['buildingName'];
|
||||
departmentId = json['departmentId'];
|
||||
departmentName = json['departmentName'];
|
||||
floorId = json['floorId'];
|
||||
floorName = json['floorName'];
|
||||
rootCauseId = json['rootCauseId'];
|
||||
rootCauseName = json['rootCauseName'];
|
||||
rootCauseValue = json['rootCauseValue'];
|
||||
otherRootCause = json['otherRootCause'];
|
||||
comments = json['comments'];
|
||||
personInvolvedId = json['personInvolvedId'];
|
||||
personInvolvedName = json['personInvolvedName'];
|
||||
personInvolvedValue = json['personInvolvedValue'];
|
||||
genderId = json['genderId'];
|
||||
genderName = json['genderName'];
|
||||
personInvolvedEmployeeId = json['personInvolvedEmployeeId'];
|
||||
personInvolvedEmployeeName = json['personInvolvedEmployeeName'];
|
||||
assignedQAId = json['assignedQAId'];
|
||||
assignedQAName = json['assignedQAName'];
|
||||
assignedSecondaryQAId = json['assignedSecondaryQAId'];
|
||||
assignedSecondaryQAName = json['assignedSecondaryQAName'];
|
||||
qaLeaderId = json['qaLeaderId'];
|
||||
qaLeaderName = json['qaLeaderName'];
|
||||
correctiveAction = json['correctiveAction'];
|
||||
escalateToOvrId = json['escalateToOvrId'];
|
||||
escalateToOvrName = json['escalateToOvrName'];
|
||||
immediateActionId = json['immediateActionId'];
|
||||
immediateActionName = json['immediateActionName'];
|
||||
clinicalOrNonClinicalId = json['clinicalOrNonClinicalId'];
|
||||
clinicalOrNonClinicalName = json['clinicalOrNonClinicalName'];
|
||||
recommendation = json['recommendation'];
|
||||
requestorUserId = json['requestorUserId'];
|
||||
requesterEmployeeId = json['requesterEmployeeId'];
|
||||
requesterEmployeeName = json['requesterEmployeeName'];
|
||||
requesterEmployeeEmail = json['requesterEmployeeEmail'];
|
||||
requesterPosition = json['requesterPosition'];
|
||||
requesterContactNo = json['requesterContactNo'];
|
||||
requesterExtensionNo = json['requesterExtensionNo'];
|
||||
requestorSiteId = json['requestorSiteId'];
|
||||
requestorSiteName = json['requestorSiteName'];
|
||||
requestorDepartmentId = json['requestorDepartmentId'];
|
||||
requestorDepartmentName = json['requestorDepartmentName'];
|
||||
requestorFlowDepartmentId = json['requestorFlowDepartmentId'];
|
||||
requestorFlowDepartmentName = json['requestorFlowDepartmentName'];
|
||||
requestorFlowDepartmentShortCode = json['requestorFlowDepartmentShortCode'];
|
||||
approvalSignature = json['approvalSignature'];
|
||||
occurrenceDate = json['occurrenceDate'];
|
||||
createdDate = json['createdDate'];
|
||||
if (json['incidentAttachments'] != null) {
|
||||
incidentAttachments = <IncidentAttachments>[];
|
||||
json['incidentAttachments'].forEach((v) {
|
||||
incidentAttachments!.add(IncidentAttachments.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['reqNo'] = this.reqNo;
|
||||
data['reqCode'] = this.reqCode;
|
||||
data['incidentStatusId'] = this.incidentStatusId;
|
||||
data['incidentStatusName'] = this.incidentStatusName;
|
||||
data['incidentStatusValue'] = this.incidentStatusValue;
|
||||
data['incidentClassificationId'] = this.incidentClassificationId;
|
||||
data['incidentClassificationName'] = this.incidentClassificationName;
|
||||
data['incidentClassificationValue'] = this.incidentClassificationValue;
|
||||
data['existingOvrTicketId'] = this.existingOvrTicketId;
|
||||
data['existingOvrTicketName'] = this.existingOvrTicketName;
|
||||
data['existingOvrTicketValue'] = this.existingOvrTicketValue;
|
||||
data['ovrTicketNumber'] = this.ovrTicketNumber;
|
||||
data['incidentTitle'] = this.incidentTitle;
|
||||
data['incidentDescription'] = this.incidentDescription;
|
||||
data['assetId'] = this.assetId;
|
||||
data['assetNumber'] = this.assetNumber;
|
||||
data['oracleCode'] = this.oracleCode;
|
||||
data['model'] = this.model;
|
||||
data['manufacturer'] = this.manufacturer;
|
||||
data['assetOrigin'] = this.assetOrigin;
|
||||
data['siteId'] = this.siteId;
|
||||
data['siteName'] = this.siteName;
|
||||
data['buildingId'] = this.buildingId;
|
||||
data['buildingName'] = this.buildingName;
|
||||
data['departmentId'] = this.departmentId;
|
||||
data['departmentName'] = this.departmentName;
|
||||
data['floorId'] = this.floorId;
|
||||
data['floorName'] = this.floorName;
|
||||
data['rootCauseId'] = this.rootCauseId;
|
||||
data['rootCauseName'] = this.rootCauseName;
|
||||
data['rootCauseValue'] = this.rootCauseValue;
|
||||
data['otherRootCause'] = this.otherRootCause;
|
||||
data['comments'] = this.comments;
|
||||
data['personInvolvedId'] = this.personInvolvedId;
|
||||
data['personInvolvedName'] = this.personInvolvedName;
|
||||
data['personInvolvedValue'] = this.personInvolvedValue;
|
||||
data['genderId'] = this.genderId;
|
||||
data['genderName'] = this.genderName;
|
||||
data['personInvolvedEmployeeId'] = this.personInvolvedEmployeeId;
|
||||
data['personInvolvedEmployeeName'] = this.personInvolvedEmployeeName;
|
||||
data['assignedQAId'] = this.assignedQAId;
|
||||
data['assignedQAName'] = this.assignedQAName;
|
||||
data['assignedSecondaryQAId'] = this.assignedSecondaryQAId;
|
||||
data['assignedSecondaryQAName'] = this.assignedSecondaryQAName;
|
||||
data['qaLeaderId'] = this.qaLeaderId;
|
||||
data['qaLeaderName'] = this.qaLeaderName;
|
||||
data['correctiveAction'] = this.correctiveAction;
|
||||
data['escalateToOvrId'] = this.escalateToOvrId;
|
||||
data['escalateToOvrName'] = this.escalateToOvrName;
|
||||
data['immediateActionId'] = this.immediateActionId;
|
||||
data['immediateActionName'] = this.immediateActionName;
|
||||
data['clinicalOrNonClinicalId'] = this.clinicalOrNonClinicalId;
|
||||
data['clinicalOrNonClinicalName'] = this.clinicalOrNonClinicalName;
|
||||
data['recommendation'] = this.recommendation;
|
||||
data['requestorUserId'] = this.requestorUserId;
|
||||
data['requesterEmployeeId'] = this.requesterEmployeeId;
|
||||
data['requesterEmployeeName'] = this.requesterEmployeeName;
|
||||
data['requesterEmployeeEmail'] = this.requesterEmployeeEmail;
|
||||
data['requesterPosition'] = this.requesterPosition;
|
||||
data['requesterContactNo'] = this.requesterContactNo;
|
||||
data['requesterExtensionNo'] = this.requesterExtensionNo;
|
||||
data['requestorSiteId'] = this.requestorSiteId;
|
||||
data['requestorSiteName'] = this.requestorSiteName;
|
||||
data['requestorDepartmentId'] = this.requestorDepartmentId;
|
||||
data['requestorDepartmentName'] = this.requestorDepartmentName;
|
||||
data['requestorFlowDepartmentId'] = this.requestorFlowDepartmentId;
|
||||
data['requestorFlowDepartmentName'] = this.requestorFlowDepartmentName;
|
||||
data['requestorFlowDepartmentShortCode'] = this.requestorFlowDepartmentShortCode;
|
||||
data['approvalSignature'] = this.approvalSignature;
|
||||
data['occurrenceDate'] = this.occurrenceDate;
|
||||
data['createdDate'] = this.createdDate;
|
||||
if (this.incidentAttachments != null) {
|
||||
data['incidentAttachments'] = this.incidentAttachments!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,178 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.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/modules/cm_module/views/components/action_button/footer_action_button.dart';
|
||||
import 'package:test_sa/modules/incident_module/incident_attachment_model.dart';
|
||||
import 'package:test_sa/modules/incident_module/incident_data_model.dart';
|
||||
import 'package:test_sa/modules/incident_module/incident_provider.dart';
|
||||
import 'package:test_sa/modules/internal_audit_module/models/internal_audit_attachment_model.dart';
|
||||
import 'package:test_sa/modules/internal_audit_module/models/system_internal_audit_data_model.dart';
|
||||
import 'package:test_sa/modules/internal_audit_module/pages/equipment_internal_audit/update_equipment_internal_audit_page.dart';
|
||||
import 'package:test_sa/modules/internal_audit_module/pages/system_internal_audit/update_system_internal_audit_page.dart';
|
||||
import 'package:test_sa/modules/internal_audit_module/provider/internal_audit_provider.dart';
|
||||
import 'package:test_sa/modules/loan_module/models/loan_attachment_model.dart';
|
||||
import 'package:test_sa/modules/loan_module/models/loan_request_model.dart';
|
||||
import 'package:test_sa/modules/loan_module/provider/loan_provider.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
||||
import 'package:test_sa/views/widgets/images/files_list.dart';
|
||||
|
||||
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
|
||||
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
|
||||
import 'package:test_sa/views/widgets/requests/request_status.dart';
|
||||
|
||||
class IncidentDetailPage extends StatelessWidget {
|
||||
static const String id = "/incident-detail-page";
|
||||
final int incidentId;
|
||||
|
||||
IncidentDetailPage({Key? key, required this.incidentId}) : super(key: key);
|
||||
|
||||
@override
|
||||
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(97),
|
||||
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),
|
||||
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),
|
||||
],
|
||||
);
|
||||
}),
|
||||
));
|
||||
}
|
||||
|
||||
List<Widget> requestDetails(BuildContext context, IncidentDataModel incidentData) {
|
||||
return [
|
||||
Text("Request Details", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
|
||||
'Incident No: ${incidentData.reqCode ?? "-"}'.bodyText(context),
|
||||
'Incident Type: ${incidentData.incidentClassificationName ?? "-"}'.bodyText(context),
|
||||
'Incident Title: ${incidentData.incidentTitle ?? "-"}'.bodyText(context),
|
||||
'Incident Description: ${incidentData.incidentDescription ?? "-"}'.bodyText(context),
|
||||
'Exist OVR: ${incidentData.existingOvrTicketName ?? "-"}'.bodyText(context),
|
||||
'Site: ${incidentData.siteName ?? "-"}'.bodyText(context),
|
||||
'Building: ${incidentData.buildingName ?? "-"}'.bodyText(context),
|
||||
'Floor: ${incidentData.floorName ?? "-"}'.bodyText(context),
|
||||
'Department: ${incidentData.departmentName ?? "-"}'.bodyText(context),
|
||||
'Occurrence Date: ${incidentData.occurrenceDate?.toServiceRequestDetailsFormat ?? "-"}'.bodyText(context),
|
||||
'Root Cause: ${incidentData.rootCauseName ?? "-"}'.bodyText(context),
|
||||
if (incidentData.rootCauseValue == 5) 'Root reason: ${incidentData.otherRootCause ?? "-"}'.bodyText(context),
|
||||
'Comments: ${incidentData.comments ?? "-"}'.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)),
|
||||
'Person Involved: ${incidentData.personInvolvedName ?? "-"}'.bodyText(context),
|
||||
'Gender: ${incidentData.genderName ?? "-"}'.bodyText(context),
|
||||
'Person Involved ID: ${incidentData.personInvolvedEmployeeId ?? "-"}'.bodyText(context),
|
||||
'Person Involved Name: ${incidentData.personInvolvedEmployeeName ?? "-"}'.bodyText(context),
|
||||
];
|
||||
}
|
||||
|
||||
List<Widget> assetDetails(BuildContext context, IncidentDataModel loanData) {
|
||||
return [
|
||||
Text("Asset Information", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
|
||||
'${context.translation.assetName}: ${loanData.assetOrigin ?? "-"}'.bodyText(context),
|
||||
'${context.translation.assetNo}: ${loanData.assetNumber ?? "-"}'.bodyText(context),
|
||||
// '${context.translation.serialNumber}: ${loanData.assetSerialNumber ?? "-"}'.bodyText(context),
|
||||
'${context.translation.manufacture}: ${loanData.manufacturer ?? "-"}'.bodyText(context),
|
||||
'${context.translation.model}: ${loanData.model ?? "-"}'.bodyText(context),
|
||||
];
|
||||
}
|
||||
|
||||
List<Widget> requesterDetails(BuildContext context, IncidentDataModel incidentData) {
|
||||
return [
|
||||
Text("Requester Information", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
|
||||
'Name: ${incidentData.requesterEmployeeName ?? "-"}'.bodyText(context),
|
||||
'Email: ${incidentData.requesterEmployeeEmail ?? "-"}'.bodyText(context),
|
||||
'Contact: ${incidentData.requesterContactNo ?? "-"}'.bodyText(context),
|
||||
'Extension: ${incidentData.requesterExtensionNo ?? "-"}'.bodyText(context),
|
||||
'Site: ${incidentData.requestorSiteName ?? "-"}'.bodyText(context),
|
||||
'Department: ${incidentData.requestorFlowDepartmentName ?? "-"}'.bodyText(context),
|
||||
];
|
||||
}
|
||||
|
||||
Widget labelValueText(BuildContext context, String label, String? value) {
|
||||
if (value == null || value.isEmpty) return const SizedBox.shrink();
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 4),
|
||||
child: Text(
|
||||
'$label: $value',
|
||||
style: AppTextStyles.bodyText.copyWith(
|
||||
color: context.isDark ? AppColor.neutral30 : AppColor.neutral120,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget checklistWidget(BuildContext context, {required String value}) {
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Checkbox(
|
||||
value: true,
|
||||
activeColor: AppColor.neutral120,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
visualDensity: const VisualDensity(horizontal: -4, vertical: -3),
|
||||
onChanged: (value) {},
|
||||
),
|
||||
value.bodyText(context),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.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/all_requests_and_count_model.dart';
|
||||
import 'package:test_sa/models/new_models/dashboard_detail.dart';
|
||||
import 'package:test_sa/modules/internal_audit_module/pages/equipment_internal_audit/equipment_internal_audit_detail_page.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
import 'package:test_sa/views/widgets/requests/request_status.dart';
|
||||
|
||||
import 'incident_detail_page.dart';
|
||||
|
||||
class IncidentItemView extends StatelessWidget {
|
||||
final Data? requestData;
|
||||
final RequestsDetails? requestDetails;
|
||||
final bool showShadow;
|
||||
|
||||
const IncidentItemView({Key? key, this.requestData, this.requestDetails, this.showShadow = true}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (requestData != null) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
StatusLabel(
|
||||
label: requestData!.statusName!,
|
||||
textColor: AppColor.getRequestStatusTextColorByName(context, requestData!.statusName!),
|
||||
backgroundColor: AppColor.getRequestStatusColorByName(context, requestData!.statusName!),
|
||||
),
|
||||
1.width.expanded,
|
||||
Text(
|
||||
requestData!.transactionDate?.toServiceRequestCardFormat ?? "",
|
||||
textAlign: TextAlign.end,
|
||||
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
||||
),
|
||||
],
|
||||
),
|
||||
8.height,
|
||||
(requestData?.typeTransaction ?? "Loan Request").heading5(context),
|
||||
infoWidget(label: context.translation.requestType, value: requestData?.requestTypeName, context: context),
|
||||
infoWidget(label: "Incident No", value: requestData?.requestNo, context: context),
|
||||
// infoWidget(label: context.translation.site, value: requestData?., context: context),
|
||||
8.height,
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
context.translation.viewDetails,
|
||||
style: AppTextStyles.bodyText.copyWith(color: AppColor.blueStatus(context)),
|
||||
),
|
||||
4.width,
|
||||
Icon(Icons.arrow_forward, color: AppColor.blueStatus(context), size: 14)
|
||||
],
|
||||
),
|
||||
],
|
||||
).toShadowContainer(context, withShadow: showShadow).onPress(() async {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => IncidentDetailPage(incidentId: requestDetails!.id!)));
|
||||
});
|
||||
}
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
StatusLabel(
|
||||
label: requestDetails!.status!,
|
||||
textColor: AppColor.getRequestStatusTextColorByName(context, requestDetails?.status!),
|
||||
backgroundColor: AppColor.getRequestStatusColorByName(context, requestDetails?.status!),
|
||||
),
|
||||
1.width.expanded,
|
||||
Text(
|
||||
requestDetails!.date?.toServiceRequestCardFormat ?? "",
|
||||
textAlign: TextAlign.end,
|
||||
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
||||
),
|
||||
],
|
||||
),
|
||||
8.height,
|
||||
(requestDetails?.nameOfType ?? "Loan Request").heading5(context),
|
||||
8.height,
|
||||
infoWidget(label: context.translation.requestType, value: requestDetails!.requestType, context: context),
|
||||
infoWidget(label: "Incident No", value: requestDetails!.requestNo, context: context),
|
||||
infoWidget(label: context.translation.site, value: requestDetails!.site, context: context),
|
||||
8.height,
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
context.translation.viewDetails,
|
||||
style: AppTextStyles.bodyText.copyWith(color: AppColor.blueStatus(context)),
|
||||
),
|
||||
4.width,
|
||||
Icon(Icons.arrow_forward, color: AppColor.blueStatus(context), size: 14)
|
||||
],
|
||||
),
|
||||
],
|
||||
).toShadowContainer(context, withShadow: showShadow).onPress(() async {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => IncidentDetailPage(incidentId: requestDetails!.id!)));
|
||||
});
|
||||
}
|
||||
|
||||
Widget infoWidget({required String label, String? value, required BuildContext context}) {
|
||||
if (value != null && value.isNotEmpty) {
|
||||
return '$label: $value'.bodyText(context);
|
||||
}
|
||||
return const SizedBox();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue