@ -1,5 +1,3 @@
import ' dart:io ' ;
import ' package:flutter/material.dart ' ;
import ' package:provider/provider.dart ' ;
import ' package:test_sa/controllers/api_routes/urls.dart ' ;
@ -22,6 +20,7 @@ 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/views/widgets/images/files_list.dart ' ;
import ' package:test_sa/views/widgets/images/multi_image_picker.dart ' ;
import ' package:test_sa/views/widgets/item_views/info_date_widget.dart ' ;
import ' package:test_sa/views/widgets/item_views/info_header_widget.dart ' ;
import ' package:test_sa/views/widgets/item_views/info_text_widget.dart ' ;
import ' package:test_sa/views/widgets/loaders/no_data_found.dart ' ;
@ -50,26 +49,27 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
@ override
Widget build ( BuildContext context ) {
/ / GenericAttachmentModel (
/ / id: e . id ,
/ / name: e . name ,
/ / createdBy: e . createdBy ,
/ / / / originalName: ,
/ / localFile: File ( e . name ? ? ' ' ) ,
/ /
/ / )
UserProvider _userProvider = Provider . of < UserProvider > ( context , listen: false ) ;
UserProvider userProvider = Provider . of < UserProvider > ( context , listen: false ) ;
return Consumer < CMDetailProvider > ( builder: ( pContext , requestProvider , _ ) {
if ( _ userProvider. user ? . type = = UsersTypes . engineer ) {
if ( userProvider . user ? . type = = UsersTypes . engineer ) {
/ / _userAttachments = requestProvider . currentWorkOrder ? . data ? . workOrderAttachments . where ( ( e ) = > e . createdBy = = _userProvider . user ? . userID ) . map ( ( e ) = > File ( e . name ? ? ' ' ) ) . toList ( ) ? ? [ ] ;
_userAttachments =
requestProvider . currentWorkOrder ? . data ? . workOrderAttachments . where ( ( e ) = > e . createdBy = = _ userProvider. user ? . userID ) . map ( ( e ) = > GenericAttachmentModel . fromJson ( e . toJson ( ) ) ) . toList ( ) ? ? [ ] ;
_attachments = requestProvider . currentWorkOrder ? . data ? . workOrderAttachments . where ( ( e ) = > e . createdBy ! = _ userProvider. user ? . userID ) . toList ( ) ? ? [ ] ;
requestProvider . currentWorkOrder ? . data ? . workOrderAttachments . where ( ( e ) = > e . createdBy = = userProvider . user ? . userID ) . map ( ( e ) = > GenericAttachmentModel . fromJson ( e . toJson ( ) ) ) . toList ( ) ? ? [ ] ;
_attachments = requestProvider . currentWorkOrder ? . data ? . workOrderAttachments . where ( ( e ) = > e . createdBy ! = userProvider . user ? . userID ) . toList ( ) ? ? [ ] ;
} else {
/ / show only nurse attachments
_attachments = requestProvider . currentWorkOrder ? . data ? . workOrderAttachments . where ( ( e ) = > e . createdBy = = _ userProvider. user ? . userID ) . toList ( ) ? ? [ ] ;
_attachments = requestProvider . currentWorkOrder ? . data ? . workOrderAttachments . where ( ( e ) = > e . createdBy = = userProvider. user ? . userID ) . toList ( ) ? ? [ ] ;
}
bool showInitialVisitCard = requestProvider . currentWorkOrder ! . data ! . needAVisitDateTime ! = null & &
userProvider . user ? . type = = UsersTypes . engineer & &
requestProvider . currentWorkOrder ? . data ? . nextStep ! . workOrderNextStepEnum = = WorkOrderNextStepEnum . eArrived ;
bool showAssetDetailCard = ( userProvider . user ? . type = = UsersTypes . engineer & & requestProvider . currentWorkOrder ? . data ? . nextStep ! . workOrderNextStepEnum = = WorkOrderNextStepEnum . activity ) | |
requestProvider . isReadOnlyRequest ;
bool showCostCard = context . userProvider . user ! . type = = UsersTypes . engineer & &
! requestProvider . isReadOnlyRequest & &
requestProvider . currentWorkOrder ! . data ! . nextStep ? . workOrderNextStepEnum = = WorkOrderNextStepEnum . activity ;
return requestProvider . isLoading
? CircularProgressIndicator ( color: AppColor . loadingColor ( context ) ) . center
: requestProvider . currentWorkOrder = = null
@ -82,17 +82,21 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
workOrderDetailCard ( context , requestProvider . currentWorkOrder ! . data ! , _userProvider , requestProvider ) ,
initialVisitCard ( requestDetailProvider: requestProvider , userProvider: _userProvider ) ,
12. height ,
assetDetailCard ( requestDetailProvider: requestProvider , userProvider: _userProvider ) ,
12. height ,
if ( context . userProvider . user ! . type = = UsersTypes . engineer & &
! requestProvider . isReadOnlyRequest & &
requestProvider . currentWorkOrder ! . data ! . nextStep ? . workOrderNextStepEnum = = WorkOrderNextStepEnum . activity ) . . . [
workOrderDetailCard ( context , requestProvider . currentWorkOrder ! . data ! , userProvider , requestProvider ) ,
if ( showInitialVisitCard ) . . . [
16. height ,
const InitialVisitCard ( ) ,
/ / initialVisitCard ( requestDetailProvider: requestProvider , userProvider: _userProvider ) ,
] ,
if ( showAssetDetailCard ) . . . [
16. height ,
assetDetailCard ( requestDetailProvider: requestProvider , userProvider: userProvider ) ,
] ,
if ( showCostCard ) . . . [
16. height ,
costCard ( context , requestProvider ) ,
12. height ,
] ,
16. height ,
contactInfoCard ( context , requestProvider . currentWorkOrder ! . data ! ) ,
20. height ,
] ,
@ -107,7 +111,7 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
status: requestProvider . currentWorkOrder ? . data ? . status ,
isEmpIsAssigned: requestProvider . currentWorkOrder ! . data ! . assignedEmployee ! = null ,
activities: requestProvider . currentWorkOrder ! . data ? . activities ? ? [ ] ,
userProvider: _ userProvider,
userProvider: userProvider,
context: context ) ,
)
] ,
@ -182,159 +186,55 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
/ / / / Navigator . push ( context , MaterialPageRoute ( builder: ( context ) = > UpdateServiceRequestPage ( serviceRequest: serviceRequest ) ) ) ;
/ / } ) ,
/ / if ( userProvider . user ! . type = = UsersTypes . engineer ) 16. height ,
Text (
workOrder . requestedDate ! . toString ( ) . toServiceRequestCardFormat ,
textAlign: TextAlign . end ,
style: AppTextStyles . tinyFont . copyWith ( color: context . isDark ? AppColor . neutral30 : AppColor . neutral50 ) ,
) ,
InfoDateWidget ( workOrder . requestedDate ? . toString ( ) ? ? " " ) ,
] ,
)
] ,
) ,
8. height ,
Text (
context . translation . assetInformation ,
style: AppTextStyles . heading5 . copyWith ( color: context . isDark ? AppColor . neutral30 : AppColor . neutral50 ) ,
) ,
/ / InfoHeader16Widget ( context . translation . assetInformation ) ,
8. height ,
InfoTextWidget ( label: context . translation . assetName , value: workOrder . assetNdModel ! . name ? . cleanupWhitespace ? . capitalizeFirstOfEach ) ,
Text (
' ${ context . translation . assetName } : ${ workOrder . assetNdModel ! . name ? . cleanupWhitespace ? . capitalizeFirstOfEach } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . assetNumber } : ${ workOrder . asset ! . assetNumber } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . serialNo } : ${ workOrder . asset ! . assetSerialNo } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . manufacture } : ${ workOrder . manufacturer ? . name ? . cleanupWhitespace ? . capitalizeFirstOfEach } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . model } : ${ workOrder . model ? . name ! . cleanupWhitespace ? . capitalizeFirstOfEach } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . site } : ${ workOrder . site ? . siteName ? . cleanupWhitespace ? . capitalizeFirstOfEach } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . building } : ${ workOrder . building ? . name ? . cleanupWhitespace ? . capitalizeFirstOfEach } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . floor } : ${ workOrder . floor ? . name ? . cleanupWhitespace ? . capitalizeFirstOfEach ? ? " " } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . department } : ${ workOrder . department ? . name ? . cleanupWhitespace ? . capitalizeFirstOfEach } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . room } : ${ ( workOrder . room ? . name ? ? " " ) . cleanupWhitespace ? . capitalizeFirstOfEach } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
InfoHeader16Widget ( context . translation . assetInformation ) ,
InfoTextWidget ( label: context . translation . assetName , value: workOrder . assetNdModel ! . name ? . cleanupWhitespace . capitalizeFirstOfEach ) ,
InfoTextWidget ( label: context . translation . assetNumber , value: workOrder . asset ! . assetNumber ) ,
InfoTextWidget ( label: context . translation . serialNo , value: workOrder . asset ! . assetSerialNo ) ,
InfoTextWidget ( label: context . translation . manufacture , value: workOrder . manufacturer ? . name ? . cleanupWhitespace . capitalizeFirstOfEach ) ,
InfoTextWidget ( label: context . translation . model , value: workOrder . model ? . name ! . cleanupWhitespace . capitalizeFirstOfEach ) ,
InfoTextWidget ( label: context . translation . site , value: workOrder . site ? . siteName ? . cleanupWhitespace . capitalizeFirstOfEach ) ,
InfoTextWidget ( label: context . translation . building , value: workOrder . building ? . name ? . cleanupWhitespace . capitalizeFirstOfEach ) ,
InfoTextWidget ( label: context . translation . floor , value: workOrder . floor ? . name ? . cleanupWhitespace . capitalizeFirstOfEach ? ? " " ) ,
InfoTextWidget ( label: context . translation . department , value: workOrder . department ? . name ? . cleanupWhitespace . capitalizeFirstOfEach ) ,
InfoTextWidget ( label: context . translation . room , value: ( workOrder . room ? . name ? ? " " ) . cleanupWhitespace . capitalizeFirstOfEach ) ,
] ,
) . expanded ,
] ,
) ,
8. height ,
const Divider ( ) . defaultStyle ( context ) ,
/ / . . . request details starts here . . . .
Text (
context . translation . callDetails ,
style: AppTextStyles . heading4 . copyWith ( color: context . isDark ? AppColor . neutral30 : AppColor . neutral50 ) ,
) ,
8. height ,
/ / Text (
/ / ' ${ context . translation . requestType } : ${ workOrder . typeofRequest ? . name } ' ,
/ / style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
/ / ) ,
Text (
' ${ context . translation . cmNumber } : ${ workOrder . workOrderNo } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . createdBy } : ${ workOrder . workOrderCreatedBy ? . userName ? ? " - " } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
InfoHeader16Widget ( context . translation . callDetails ) ,
InfoTextWidget ( label: context . translation . cmNumber , value: workOrder . workOrderNo ) ,
InfoTextWidget ( label: context . translation . createdBy , value: workOrder . workOrderCreatedBy ? . userName ? ? " - " ) ,
InfoTextWidget ( label: context . translation . arrivedDate , value: workOrder . iHaveArrivedDate ! = null ? workOrder . iHaveArrivedDate . toString ( ) . toServiceRequestDetailsFormat : ' - ' ) ,
InfoTextWidget ( label: context . translation . closedDate , value: workOrder . closedDate ! = null ? workOrder . closedDate ! . toString ( ) . toServiceRequestDetailsFormat : ' - ' ) ,
if ( workOrder . problemDescription ! = null ) InfoTextWidget ( label: context . translation . problemDesc , value: workOrder . problemDescription ? . name ? ? " " ) ,
Text (
' ${ context . translation . arrivedDate } : ${ workOrder . iHaveArrivedDate ! = null ? workOrder . iHaveArrivedDate . toString ( ) . toServiceRequestDetailsFormat : ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral30 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . closedDate } : ${ workOrder . closedDate ! = null ? workOrder . closedDate ! . toString ( ) . toServiceRequestDetailsFormat : ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral30 : AppColor . neutral120 ) ,
) ,
if ( workOrder . problemDescription ! = null )
Text (
' ${ context . translation . problemDesc } : ${ workOrder . problemDescription ? . name ? ? " " } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
const Divider ( ) . defaultStyle ( context ) ,
/ / . . . call response details starts here . . . .
Text (
context . translation . callResponse ,
style: AppTextStyles . heading4 . copyWith ( color: context . isDark ? AppColor . neutral30 : AppColor . neutral50 ) ,
) ,
8. height ,
Text (
' ${ context . translation . assignedTo } : ${ workOrder . assignedEmployee ? . userName ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . assetStatus } : ${ workOrder . equipmentStatus ? . name ? ? " - " } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . activityStatus } : ${ workOrder . lastActivityStatus ? . name ? ? " - " } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . callResponse } : ${ workOrder . callResponse ? ? " - " } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
/ / Text (
/ / ' ${ context . translation . since } : ${ workOrder . since ! = null ? ' $ {workOrder.since } days ' : ' - ' } ' ,
/ / style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
/ / ) ,
InfoHeader16Widget ( context . translation . callResponse ) ,
InfoTextWidget ( label: context . translation . assignedTo , value: workOrder . assignedEmployee ? . userName ? ? ' - ' ) ,
InfoTextWidget ( label: context . translation . assetStatus , value: workOrder . equipmentStatus ? . name ? ? " - " ) ,
InfoTextWidget ( label: context . translation . activityStatus , value: workOrder . lastActivityStatus ? . name ? ? " - " ) ,
InfoTextWidget ( label: context . translation . callResponse , value: workOrder . callResponse ? ? " - " ) ,
8. height ,
if ( workOrder . rejectReason ! = null ) . . . [
const Divider ( ) . defaultStyle ( context ) ,
8. height ,
Text (
context . translation . rejectionDetails ,
style: AppTextStyles . heading4 . copyWith ( color: context . isDark ? AppColor . neutral30 : AppColor . neutral50 ) ,
) ,
8. height ,
Text (
' ${ context . translation . rejectionReason } : ${ workOrder . rejectReason ? . name ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
8. height ,
Text (
' ${ context . translation . comment } : ${ workOrder . rejectComment ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
InfoHeader16Widget ( context . translation . rejectionDetails ) ,
InfoTextWidget ( label: context . translation . rejectionReason , value: workOrder . rejectReason ? . name ? ? ' - ' ) ,
InfoTextWidget ( label: context . translation . comment , value: workOrder . rejectComment ? ? ' - ' ) ,
] ,
8. height ,
if ( ( workOrder . comments ? ? " " ) . isNotEmpty ) . . . [
const Divider ( ) . defaultStyle ( context ) ,
8. height ,
Text (
context . translation . callComments ,
style: AppTextStyles . heading4 . copyWith ( color: context . isDark ? AppColor . neutral30 : AppColor . neutral50 ) ,
) ,
InfoHeader16Widget ( context . translation . callComments ) ,
8. height ,
Text (
workOrder . comments ! ,
@ -343,16 +243,11 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
] ,
if ( userProvider . user ? . type = = UsersTypes . engineer ) . . . [
if ( _attachments . isNotEmpty ) . . . [
8. height ,
const Divider ( ) . defaultStyle ( context ) ,
Text (
" Attachments " . addTranslation ,
style: AppTextStyles . heading4 . copyWith ( color: context . isDark ? AppColor . neutral30 : AppColor . neutral50 ) ,
) ,
InfoHeader16Widget ( " Attachments " . addTranslation ) ,
FilesList ( images: _attachments . map ( ( toElement ) = > URLs . getFileUrl ( toElement . name ! ) ? ? ' ' ) . toList ( ) ) ,
] ,
if ( ! requestProvider . isReadOnlyRequest & & workOrder . nextStep ? . workOrderNextStepEnum = = WorkOrderNextStepEnum . activity ) . . . [
8. height ,
const Divider ( ) . defaultStyle ( context ) ,
AttachmentPicker (
label: context . translation . attachments ,
@ -367,7 +262,6 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
) ,
] ,
] else . . . [
8. height ,
if ( _attachments . isNotEmpty ) . . . [
const Divider ( ) . defaultStyle ( context ) ,
FilesList ( images: _attachments . map ( ( toElement ) = > URLs . getFileUrl ( toElement . name ! ) ! ) . toList ( ) ) ,
@ -377,69 +271,10 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
if ( workOrder . voiceNote ? . isNotEmpty ? ? false ) . . . [
const Divider ( ) . defaultStyle ( context ) ,
16. height ,
ASoundPlayer ( audio: URLs . getFileUrl ( workOrder . voiceNote ! ) ! ) ,
8. height ,
] ,
] ,
) . paddingOnly ( start: 16 , end: 16 , top: 16 , bottom: 8 ) ,
/ / ( userProvider . user ! . type = = UsersTypes . normal_user
/ / ? Container (
/ / height: 50 ,
/ / padding: const EdgeInsets . only ( left: 16 , right: 16 ) ,
/ / alignment: Alignment . center ,
/ / width: double . infinity ,
/ / decoration: ShapeDecoration (
/ / color: context . isDark ? AppColor . neutral50 : AppColor . neutral30 ,
/ / shape: const RoundedRectangleBorder (
/ / borderRadius: BorderRadius . only (
/ / bottomLeft: Radius . circular ( 20 ) ,
/ / bottomRight: Radius . circular ( 20 ) ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / child: Row (
/ / children: [
/ / Text (
/ / ' ${ context . translation . commentHere } ... ' ,
/ / style: AppTextStyles . heading6 . copyWith (
/ / color: ( context . isDark ? AppColor . neutral30 : AppColor . neutral50 ) . withOpacity ( . 6 ) ,
/ / ) ,
/ / ) . expanded ,
/ / " comment_send " . toSvgAsset ( width: 24 , color: context . isDark ? AppColor . primary50 : AppColor . primary70 ) ,
/ / ] ,
/ / ) ,
/ / )
/ / : Column (
/ / mainAxisSize: MainAxisSize . min ,
/ / crossAxisAlignment: CrossAxisAlignment . start ,
/ / children: [
/ / const Divider ( ) . defaultStyle ( context ) ,
/ / 16. height ,
/ / Row (
/ / mainAxisSize: MainAxisSize . min ,
/ / children: [
/ / Text (
/ / context . translation . viewComments ,
/ / style: AppTextStyles . bodyText . copyWith ( color: AppColor . blueStatus ( context ) ) ,
/ / ) ,
/ / 4. width ,
/ / Icon ( Icons . arrow_forward , color: AppColor . blueStatus ( context ) , size: 14 )
/ / ] ,
/ / ) ,
/ / ] ,
/ / ) . paddingOnly ( bottom: 16 , start: 16 , end: 16 ) )
/ / . onPress ( ( ) {
/ / / / showModalBottomSheet (
/ / / / context: context ,
/ / / / useSafeArea: true ,
/ / / / isScrollControlled: true ,
/ / / / useRootNavigator: true ,
/ / / / backgroundColor: Colors . transparent ,
/ / / / builder: ( context ) = > CommentsBottomSheet ( requestId: serviceRequest . id ! ) ,
/ / / / ) ;
/ / } ) ,
/ / set condition for show asset detail button . . .
) . paddingAll ( 16 ) ,
if ( ( workOrder . nextStep ! . workOrderNextStepEnum = = WorkOrderNextStepEnum . verifyAssetDetail | | workOrder . nextStep ! . workOrderNextStepEnum = = WorkOrderNextStepEnum . activity ) & &
userProvider . user ? . type = = UsersTypes . engineer ) . . . [
assetRetiredButton ( context: context ) ,
@ -453,11 +288,7 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text (
" Contact Info " ,
style: AppTextStyles . heading4 . copyWith ( color: context . isDark ? AppColor . neutral30 : AppColor . neutral50 ) ,
) ,
/ / 8. height ,
InfoHeader16Widget ( " Contact Info " ) ,
ListView . separated (
physics: const NeverScrollableScrollPhysics ( ) ,
shrinkWrap: true ,
@ -465,36 +296,18 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
itemBuilder: ( cxt , index ) = > Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text (
' ${ workOrder . workOrderContactPerson [ index ] . name ? ? ' - ' } ' ,
style: AppTextStyles . heading6 . copyWith ( color: context . isDark ? AppColor . neutral30 : AppColor . neutral50 ) ,
) ,
Text (
' ${ context . translation . employeeId } : ${ workOrder . workOrderContactPerson [ index ] . employeeId ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . telephone } : ${ workOrder . workOrderContactPerson [ index ] . mobilePhone ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' Job: ${ workOrder . workOrderContactPerson [ index ] . position ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' ${ context . translation . email } : ${ workOrder . workOrderContactPerson [ index ] . email ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' Extension: ${ workOrder . workOrderContactPerson [ index ] . extension ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
InfoTextWidget ( label: ' Name ' . addTranslation , value: workOrder . workOrderContactPerson [ index ] . name ? ? ' - ' ) ,
InfoTextWidget ( label: context . translation . employeeId , value: workOrder . workOrderContactPerson [ index ] . employeeId ? ? ' - ' ) ,
InfoTextWidget ( label: context . translation . telephone , value: workOrder . workOrderContactPerson [ index ] . mobilePhone ? ? ' - ' ) ,
InfoTextWidget ( label: ' Job ' . addTranslation , value: workOrder . workOrderContactPerson [ index ] . position ? ? ' - ' ) ,
InfoTextWidget ( label: context . translation . email , value: workOrder . workOrderContactPerson [ index ] . email ? ? ' - ' ) ,
InfoTextWidget ( label: ' Extension ' . addTranslation , value: workOrder . workOrderContactPerson [ index ] . extension ? ? ' - ' ) ,
] ,
) ,
separatorBuilder: ( cxt , index ) = > const Divider ( ) . defaultStyle ( context ) ,
itemCount: workOrder . workOrderContactPerson . length ) ,
] ,
) . toShadowContainer ( context , padding: 1 2 ) ;
) . toShadowContainer ( context , padding: 16 ) ;
}
Widget costCard ( BuildContext context , CMDetailProvider provider ) {
@ -504,10 +317,8 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
children: [
Row (
children: [
Text (
" Cost " ,
style: AppTextStyles . heading4 . copyWith ( color: context . isDark ? AppColor . neutral30 : AppColor . neutral50 ) ,
) . expanded ,
InfoHeader16Widget ( " Cost " ) ,
const Spacer ( ) ,
if ( ! provider . isReadOnlyRequest )
" edit_icon " . toSvgAsset ( height: 24 , width: 24 , color: AppColor . icon2Color ( context ) ) . onPress ( ( ) async {
provider . refreshTimer = false ;
@ -516,46 +327,16 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
} ) ,
] ,
) ,
Column (
crossAxisAlignment: CrossAxisAlignment . start ,
mainAxisSize: MainAxisSize . min ,
children: [
Text (
' Spare Part Cost: ${ provider . currentWorkOrder ! . data ? . sparePartCost ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' Labor Cost: ${ provider . currentWorkOrder ! . data ? . labourCost ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' Travel Cost: ${ provider . currentWorkOrder ! . data ? . travelCost ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' Quot Amount: ${ provider . currentWorkOrder ! . data ? . qAmount ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' PR No: ${ provider . currentWorkOrder ! . data ? . prNo ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' PO No: ${ provider . currentWorkOrder ! . data ? . poNo ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' MR No: ${ provider . currentWorkOrder ! . data ? . mrNo ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
Text (
' Exchange Cost: ${ provider . currentWorkOrder ! . data ? . exchangeCost ? ? ' - ' } ' ,
style: AppTextStyles . bodyText . copyWith ( color: context . isDark ? AppColor . neutral10 : AppColor . neutral120 ) ,
) ,
] ,
) ,
InfoTextWidget ( label: ' Spare Part Cost ' . addTranslation , value: provider . currentWorkOrder ? . data ? . sparePartCost ? . toString ( ) ? ? ' - ' ) ,
InfoTextWidget ( label: ' Labor Cost ' . addTranslation , value: provider . currentWorkOrder ? . data ? . labourCost ? . toString ( ) ? ? ' - ' ) ,
InfoTextWidget ( label: ' Travel Cost ' . addTranslation , value: provider . currentWorkOrder ? . data ? . travelCost ? . toString ( ) ? ? ' - ' ) ,
InfoTextWidget ( label: ' Quot Amount ' . addTranslation , value: provider . currentWorkOrder ? . data ? . qAmount ? . toString ( ) ? ? ' - ' ) ,
InfoTextWidget ( label: ' PR No ' . addTranslation , value: provider . currentWorkOrder ? . data ? . prNo ? . toString ( ) ? ? ' - ' ) ,
InfoTextWidget ( label: ' PO No ' . addTranslation , value: provider . currentWorkOrder ? . data ? . poNo ? . toString ( ) ? ? ' - ' ) ,
InfoTextWidget ( label: ' MR No ' . addTranslation , value: provider . currentWorkOrder ? . data ? . mrNo ? . toString ( ) ? ? ' - ' ) ,
InfoTextWidget ( label: ' Exchange Cost ' . addTranslation , value: provider . currentWorkOrder ? . data ? . exchangeCost ? . toString ( ) ? ? ' - ' ) ,
] ,
) . toShadowContainer ( context );
) . toShadowContainer ( context , padding: 16 ) ;
}
Widget assetRetiredButton ( { required BuildContext context } ) {
@ -577,11 +358,6 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
if ( requestDetailProvider . currentWorkOrder ! . data ! . needAVisitDateTime ! = null & &
userProvider . user ? . type = = UsersTypes . engineer & &
requestDetailProvider . currentWorkOrder ? . data ? . nextStep ! . workOrderNextStepEnum = = WorkOrderNextStepEnum . eArrived ) {
/ / requestDetailProvider . needVisitHelperModel = NeedVisitHelperModel (
/ / workOrderId: requestDetailProvider . currentWorkOrder ? . data ? . requestId ,
/ / visitDate: requestDetailProvider . currentWorkOrder ? . data ? . needAVisitDateTime ,
/ / comment: requestDetailProvider . currentWorkOrder ? . data ? . needAVisitComment ,
/ / ) ;
return const InitialVisitCard ( ) ;
} else {
return const SizedBox ( ) ;
@ -589,26 +365,21 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
}
Widget assetDetailCard ( { required CMDetailProvider requestDetailProvider , required UserProvider userProvider } ) {
if ( ( userProvider . user ? . type = = UsersTypes . engineer & & requestDetailProvider . currentWorkOrder ? . data ? . nextStep ! . workOrderNextStepEnum = = WorkOrderNextStepEnum . activity ) | |
requestDetailProvider . isReadOnlyRequest ) {
WorkOrderData currentWorkOrderData = requestDetailProvider . currentWorkOrder ! . data ! ;
requestDetailProvider . engineerUpdateWorkOrderHelperModel = EngineerUpdateWorkOrderHelperModel (
workOrderId: currentWorkOrderData . requestId ,
equipmentStatus: currentWorkOrderData . equipmentStatus ,
loanAvailability: currentWorkOrderData . loanAvailablity ,
failureReason: currentWorkOrderData . failureReasone ,
faultDescription: currentWorkOrderData . faultDescription ,
solution: currentWorkOrderData . faultDescription ? . workPerformed ,
returnToService: currentWorkOrderData . returnToService ,
serviceType: currentWorkOrderData . serviceType ,
descriptionOfFinding: currentWorkOrderData . descriptionOfFinding ,
actionTaken: currentWorkOrderData . actionTaken ,
edd: currentWorkOrderData . edd ,
cmFrameId: currentWorkOrderData . cmFrame ,
) ;
return const AssetDetailCard ( ) ;
} else {
return const SizedBox ( ) ;
}
WorkOrderData currentWorkOrderData = requestDetailProvider . currentWorkOrder ! . data ! ;
requestDetailProvider . engineerUpdateWorkOrderHelperModel = EngineerUpdateWorkOrderHelperModel (
workOrderId: currentWorkOrderData . requestId ,
equipmentStatus: currentWorkOrderData . equipmentStatus ,
loanAvailability: currentWorkOrderData . loanAvailablity ,
failureReason: currentWorkOrderData . failureReasone ,
faultDescription: currentWorkOrderData . faultDescription ,
solution: currentWorkOrderData . faultDescription ? . workPerformed ,
returnToService: currentWorkOrderData . returnToService ,
serviceType: currentWorkOrderData . serviceType ,
descriptionOfFinding: currentWorkOrderData . descriptionOfFinding ,
actionTaken: currentWorkOrderData . actionTaken ,
edd: currentWorkOrderData . edd ,
cmFrameId: currentWorkOrderData . cmFrame ,
) ;
return const AssetDetailCard ( ) ;
}
}