Merge remote-tracking branch 'origin/export_module_ui_ux_enhancement' into export_module_ui_ux_enhancement

# Conflicts:
#	lib/modules/cm_module/views/components/service_request_detail_view.dart
main_production_RSG
Sikander Saleem 2 months ago
commit af14528f52

@ -4,8 +4,8 @@ class URLs {
static const String appReleaseBuildNumber = "40";
// static const host1 = "https://atomsm.hmg.com"; // production url
static const host1 = "https://atomsmdev.hmg.com"; // local DEV url
// static const host1 = "https://atomsmuat.hmg.com"; // local UAT url
// static const host1 = "https://atomsmdev.hmg.com"; // local DEV url
static const host1 = "https://atomsmuat.hmg.com"; // local UAT url
static final String _baseUrl = "$_host/mobile"; // host local UAT
// static final String _baseUrl = "$_host/v1/mobile"; // new V2 apis

@ -19,6 +19,9 @@ import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_lazy_loading.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.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';
class AssetDeliveryPage extends StatefulWidget {
final int? requestId;
@ -83,27 +86,28 @@ class _AssetDeliveryPageState extends State<AssetDeliveryPage> {
selector: (_, provider) => provider.assetDeliveryDataModel,
builder: (context, dataModel, child) {
if (loading) {
return CircularProgressIndicator(color: AppColor.loadingColor(context),).center;
return CircularProgressIndicator(
color: AppColor.loadingColor(context),
).center;
}
if (dataModel == null) {
return const NoDataFound().center;
}
// Access provider without listening for operations
final provider = Provider.of<AssetDeliveryProvider>(context, listen: false);
return SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
requestDetailCard(context).toShadowContainer(context, borderRadius: 20),
20.height,
requestDetailCard(context).toShadowContainer(context, borderRadius: 20, padding: 0),
16.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
InfoHeader16Widget(
"Asset Delivery Table".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
),
Row(
children: [
@ -155,25 +159,9 @@ class _AssetDeliveryPageState extends State<AssetDeliveryPage> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'PO No. Internal'.addTranslation,
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
),
8.height,
Text(
widget.poInternal ?? '-',
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
),
8.height,
Text(
'Client Name'.addTranslation,
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
),
8.height,
Text(
dataModel?.clientName ?? '-',
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
),
InfoHeader16Widget('PO Details'.addTranslation),
InfoTextWidget(label: 'PO No. Internal'.addTranslation, value: widget.poInternal ?? '-'),
InfoTextWidget(label: 'Client Name'.addTranslation, value: dataModel?.clientName ?? '-'),
// Row(
// mainAxisSize: MainAxisSize.min,
// children: [
@ -191,102 +179,21 @@ class _AssetDeliveryPageState extends State<AssetDeliveryPage> {
// ),
// ],
// ),
8.height,
if (dataModel?.isHMG == true) ...[
Text(
'Operation Units'.addTranslation,
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
),
8.height,
Text(
dataModel?.operatingUnit ?? '-',
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
),
InfoTextWidget(label: 'Operation Units'.addTranslation, value: dataModel?.operatingUnit ?? '-'),
] else ...[
Text(
'Site'.addTranslation,
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
),
8.height,
Text(
dataModel?.site?.siteName ?? '-',
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
),
InfoTextWidget(label: 'Site'.addTranslation, value: dataModel?.site?.siteName ?? '-'),
],
8.height,
Text(
'PO No.'.addTranslation,
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
),
8.height,
Text(
getPOExternal(),
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
),
8.height,
Text(
'Warranty Period'.addTranslation,
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
),
8.height,
Text(
dataModel?.warrentyPeriod != null ? dataModel!.warrentyPeriod.toString() : '-',
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
),
8.height,
Text(
'Payment Term'.addTranslation,
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
),
8.height,
Text(
dataModel?.paymentTerm != null ? dataModel!.paymentTerm!.name.toString() : '-',
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
),
8.height,
Text(
'Payment Terms Amount'.addTranslation,
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
),
8.height,
Text(
dataModel?.paymentTermAmount != null ? dataModel!.paymentTermAmount.toString() : '-',
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
),
8.height,
InfoTextWidget(label: 'PO No.'.addTranslation, value: getPOExternal()),
InfoTextWidget(label: 'Warranty Period'.addTranslation, value: dataModel?.warrentyPeriod != null ? dataModel!.warrentyPeriod.toString() : '-'),
InfoTextWidget(label: 'Payment Term'.addTranslation, value: dataModel?.paymentTerm != null ? dataModel!.paymentTerm!.name.toString() : '-'),
InfoTextWidget(label: 'Payment Terms Amount'.addTranslation, value: dataModel?.paymentTermAmount != null ? dataModel!.paymentTermAmount.toString() : '-'),
//Removed as request by Ahmed backend...
// Text(
// 'EDD (Estimated Delivery Date)'.addTranslation,
// style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
// ),
// 8.height,
// Text(
// dataModel?.edd != null ? dataModel!.edd!.toAssetDetailsFormat : '-',
// style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
// ),
// 8.height,
Text(
'Total'.addTranslation,
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
),
8.height,
Text(
dataModel?.total != null ? dataModel!.total.toString() : '-',
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
),
8.height,
Text(
'Total Invoice'.addTranslation,
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
),
8.height,
Text(
dataModel?.totalInvoice != null ? dataModel!.totalInvoice.toString() : '-',
style: AppTextStyles.bodyText2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
),
// InfoTextWidget(label: 'EDD (Estimated Delivery Date)'.addTranslation, value: dataModel?.edd != null ? dataModel!.edd!.toAssetDetailsFormat : '-'),
InfoTextWidget(label: 'Total'.addTranslation, value: dataModel?.total != null ? dataModel!.total.toString() : '-'),
InfoTextWidget(label: 'Total Invoice'.addTranslation, value: dataModel?.totalInvoice != null ? dataModel!.totalInvoice.toString() : '-'),
],
);
).paddingAll(16);
}
String getPOExternal() {
@ -306,7 +213,7 @@ class _AssetDeliveryPageState extends State<AssetDeliveryPage> {
Widget assetDeliveryTableList({required BuildContext context, required AssetDeliveryProvider assetDeliveryProvider}) {
List<AssetDeliveryTableModel> assetDeliveryTableList = assetDeliveryProvider.assetDeliveryTableList;
return assetDeliveryProvider.isDeliveryTableListLoading
? SizedBox(height: 200.toScreenHeight, child: CircularProgressIndicator(color: AppColor.loadingColor(context)).center)
? SizedBox(height: 200.toScreenHeight, child: CircularProgressIndicator(color: AppColor.loadingColor(context)).center)
: assetDeliveryTableList.isEmpty
? const NoDataFound().center
: ListView.separated(

@ -9,6 +9,9 @@ import 'package:test_sa/modules/asset_inventory_module/models/session_model.dart
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
import 'package:test_sa/views/widgets/requests/request_status.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';
class AssetInventoryDetailView extends StatefulWidget {
SessionModel sessionModel;
@ -33,7 +36,7 @@ class _AssetInventoryDetailViewState extends State<AssetInventoryDetailView> {
padding: const EdgeInsets.all(16),
children: [
requestDetailCard(context, widget.sessionModel),
12.height,
16.height,
siteListCard(context, widget.sessionModel),
],
);
@ -49,47 +52,24 @@ class _AssetInventoryDetailViewState extends State<AssetInventoryDetailView> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
//
StatusLabel(
label: sessionModel.statusName,
id: sessionModel.statusId,
radius: 4,
textColor: AppColor.getRequestStatusTextColorByName(context, sessionModel.statusName),
backgroundColor: AppColor.getRequestStatusColorByName(context, sessionModel.statusName),
// textColor: AppColor.green15,
// backgroundColor: AppColor.greenStatus(context),
),
Text(
sessionModel.createdDate!.toString().toServiceRequestCardFormat,
textAlign: TextAlign.end,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
)
InfoDateWidget(sessionModel.createdDate?.toString() ?? ""),
],
),
8.height,
Text(
'Session Details'.addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
Text(
'${'Session Name'.addTranslation}: ${sessionModel.sessionName?.cleanupWhitespace.capitalizeFirstOfEach}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${'Session Type'.addTranslation}: ${sessionModel.sessionTypeName}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${'Start Date'.addTranslation}: ${sessionModel.startDate?.toServiceRequestDetailsFormat ?? ""}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${'End Date'.addTranslation}: ${sessionModel.endDate?.toServiceRequestDetailsFormat ?? ""}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
InfoHeader16Widget('Session Details'.addTranslation),
InfoTextWidget(label: 'Session Name'.addTranslation, value: sessionModel.sessionName?.cleanupWhitespace.capitalizeFirstOfEach ?? '-'),
InfoTextWidget(label: 'Session Type'.addTranslation, value: sessionModel.sessionTypeName ?? '-'),
InfoTextWidget(label: 'Start Date'.addTranslation, value: sessionModel.startDate?.toServiceRequestDetailsFormat ?? '-'),
InfoTextWidget(label: 'End Date'.addTranslation, value: sessionModel.endDate?.toServiceRequestDetailsFormat ?? '-'),
],
).toShadowContainer(context, padding: 12, borderRadius: 20);
).toShadowContainer(context, padding: 16, borderRadius: 20);
}
Widget siteListCard(BuildContext context, SessionModel sessionModel) {
@ -99,16 +79,12 @@ class _AssetInventoryDetailViewState extends State<AssetInventoryDetailView> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Sites Information",
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
InfoHeader16Widget("Sites Information"),
SiteHierarchyView(
sites: sites,
),
],
).toShadowContainer(context, padding: 12, borderRadius: 20);
).toShadowContainer(context, padding: 16, borderRadius: 20);
}
}
@ -238,5 +214,3 @@ class LeafTile extends StatelessWidget {
);
}
}

@ -1,11 +1,5 @@
import 'dart:developer';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:open_file/open_file.dart';
import 'package:provider/provider.dart';
import 'package:share_plus/share_plus.dart';
import 'package:test_sa/controllers/providers/api/user_provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
@ -26,7 +20,6 @@ import 'package:test_sa/modules/loan_module/pages/create_loan_request_page.dart'
import 'package:test_sa/modules/loan_module/pages/loan_equipment_detail_page.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 'views/components/history_log_view.dart';
import 'views/components/service_request_detail_view.dart';

@ -10,6 +10,8 @@ import 'package:test_sa/modules/cm_module/views/forms/asset_retired/verify_asset
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/views/widgets/requests/request_status.dart';
import 'package:test_sa/extensions/string_extensions.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';
class AssetDetailCard extends StatelessWidget {
const AssetDetailCard({Key? key}) : super(key: key);
@ -59,42 +61,39 @@ class AssetDetailCard extends StatelessWidget {
}),
]),
6.height,
Text(
"Work Order Details",
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
InfoHeader16Widget("Work Order Details"),
InfoTextWidget(
label: context.translation.returnToService,
value: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService?.toAssetDetailsFormat ?? '-',
),
Text(
'${context.translation.returnToService}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService?.toAssetDetailsFormat ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
InfoTextWidget(
label: 'EDD',
value: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd?.toAssetDetailsFormat ?? '-',
),
Text(
'EDD: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd?.toAssetDetailsFormat ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
InfoTextWidget(
label: context.translation.loanAvailability,
value: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAvailability?.name ?? '-',
),
Text(
'${context.translation.loanAvailability}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAvailability?.name ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
InfoTextWidget(
label: context.translation.failureReason,
value: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.failureReason?.name ?? '-',
),
Text(
'${context.translation.failureReason}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.failureReason?.name ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
InfoTextWidget(
label: context.translation.faultDescription,
value: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.faultDescription?.name ?? '-',
),
Text(
'${context.translation.faultDescription}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.faultDescription?.name ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.solutions}: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.solution ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
InfoTextWidget(
label: context.translation.solutions,
value: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.solution ?? '-',
),
if (Provider.of<SettingProvider>(context, listen: false).isUserFMS) ...[
Text(
'Description of Finding: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.descriptionOfFinding ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
InfoTextWidget(
label: 'Description of Finding',
value: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.descriptionOfFinding ?? '-',
),
Text(
'Action Taken: ${requestDetailProvider.engineerUpdateWorkOrderHelperModel?.actionTaken ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
InfoTextWidget(
label: 'Action Taken',
value: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.actionTaken ?? '-',
),
]
],

@ -1,5 +1,3 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
@ -57,7 +55,7 @@ class _InitialVisitCardState extends State<InitialVisitCard> {
requestDetailProvider.needVisitHelperModel!.comment!.bodyText2(context).custom(color: AppColor.neutral120),
]
],
).toShadowContainer(context, margin: const EdgeInsets.only(top: 12));
).toShadowContainer(context, padding: 16);
});
}
}

@ -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: 12);
).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();
}
}

@ -1,5 +1,3 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
@ -8,24 +6,15 @@ 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/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';
import 'package:test_sa/views/widgets/requests/request_status.dart';
@ -62,11 +51,7 @@ class IncidentDetailPage extends StatelessWidget {
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),
),
InfoDateWidget(snapshot.data!.createdDate?.toString() ?? ""),
],
),
12.height,
@ -80,14 +65,11 @@ class IncidentDetailPage extends StatelessWidget {
...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),
),
InfoHeader16Widget("Attachments".addTranslation),
FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
],
],
).toShadowContainer(context, padding: 12),
).toShadowContainer(context, padding: 16),
],
);
}));
@ -95,20 +77,20 @@ class IncidentDetailPage extends StatelessWidget {
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),
InfoHeader16Widget("Request Details"),
InfoTextWidget(label: 'Incident No', value: incidentData.reqCode ?? "-"),
InfoTextWidget(label: 'Incident Type', value: incidentData.incidentClassificationName ?? "-"),
InfoTextWidget(label: 'Incident Title', value: incidentData.incidentTitle ?? "-"),
InfoTextWidget(label: 'Incident Description', value: incidentData.incidentDescription ?? "-"),
InfoTextWidget(label: 'Exist OVR', value: incidentData.existingOvrTicketName ?? "-"),
InfoTextWidget(label: 'Site', value: incidentData.siteName ?? "-"),
InfoTextWidget(label: 'Building', value: incidentData.buildingName ?? "-"),
InfoTextWidget(label: 'Floor', value: incidentData.floorName ?? "-"),
InfoTextWidget(label: 'Department', value: incidentData.departmentName ?? "-"),
InfoTextWidget(label: 'Occurrence Date', value: incidentData.occurrenceDate?.toServiceRequestDetailsFormat ?? "-"),
InfoTextWidget(label: 'Root Cause', value: incidentData.rootCauseName ?? "-"),
if (incidentData.rootCauseValue == 5) InfoTextWidget(label: 'Root reason', value: incidentData.otherRootCause ?? "-"),
InfoTextWidget(label: 'Comments', value: incidentData.comments ?? "-"),
];
}
@ -127,9 +109,9 @@ class IncidentDetailPage extends StatelessWidget {
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),
InfoHeader16Widget("OVR Ticket Information"),
InfoTextWidget(label: 'OVR Ticket Number', value: ovrNumber),
for (int i = 0; i < keysList.length; i++) InfoTextWidget(label: keysList[i], value: data[keysList[i]]?.toString() ?? "-"),
],
);
});
@ -137,34 +119,34 @@ class IncidentDetailPage extends StatelessWidget {
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),
InfoHeader16Widget("Person Involved Information"),
InfoTextWidget(label: 'Person Involved', value: incidentData.personInvolvedName ?? "-"),
InfoTextWidget(label: 'Gender', value: incidentData.genderName ?? "-"),
InfoTextWidget(label: 'Person Involved ID', value: incidentData.personInvolvedEmployeeId?.toString() ?? "-"),
InfoTextWidget(label: 'Person Involved Name', value: incidentData.personInvolvedEmployeeName ?? "-"),
];
}
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),
InfoHeader16Widget("Asset Information"),
InfoTextWidget(label: context.translation.assetName, value: loanData.assetOrigin ?? "-"),
InfoTextWidget(label: context.translation.assetNo, value: loanData.assetNumber ?? "-"),
// '${context.translation.serialNumber}: ${loanData.assetSerialNumber ?? "-"}'.bodyText(context),
'${context.translation.manufacture}: ${loanData.manufacturer ?? "-"}'.bodyText(context),
'${context.translation.model}: ${loanData.model ?? "-"}'.bodyText(context),
InfoTextWidget(label: context.translation.manufacture, value: loanData.manufacturer ?? "-"),
InfoTextWidget(label: context.translation.model, value: loanData.model ?? "-"),
];
}
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),
InfoHeader16Widget("Requester Information"),
InfoTextWidget(label: 'Name', value: incidentData.requesterEmployeeName ?? "-"),
InfoTextWidget(label: 'Email', value: incidentData.requesterEmployeeEmail ?? "-"),
InfoTextWidget(label: 'Contact', value: incidentData.requesterContactNo ?? "-"),
InfoTextWidget(label: 'Extension', value: incidentData.requesterExtensionNo ?? "-"),
InfoTextWidget(label: 'Site', value: incidentData.requestorSiteName ?? "-"),
InfoTextWidget(label: 'Department', value: incidentData.requestorFlowDepartmentName ?? "-"),
];
}

@ -17,6 +17,9 @@ 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/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/app_loading.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
import 'package:test_sa/views/widgets/requests/request_status.dart';
@ -114,11 +117,8 @@ class _EquipmentInternalAuditDetailPageState extends State<EquipmentInternalAudi
8.height,
if (model?.remarks?.isNotEmpty ?? false) ...[
const Divider().defaultStyle(context),
Text(
"Remarks",
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
model!.remarks!.bodyText(context),
InfoHeader16Widget("Remarks"),
Text(model!.remarks??'',style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context)),),
8.height,
],
if (allAttachments.isNotEmpty) ...[
@ -184,13 +184,8 @@ class _EquipmentInternalAuditDetailPageState extends State<EquipmentInternalAudi
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider().defaultStyle(context),
Text(
"Request Details",
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
6.height,
'${context.translation.requestNo}: ${model?.requestNo ?? '-'}'.bodyText(context),
InfoHeader16Widget("Request Details"),
InfoTextWidget(label: context.translation.requestNo, value: model?.requestNo ?? '-'),
if (model != null && model!.equipmentsFindings != null && model!.equipmentsFindings!.isNotEmpty)
...model!.equipmentsFindings!.map((item) {
final findingName = item.finding?.name ?? 'Unknown';
@ -207,18 +202,14 @@ class _EquipmentInternalAuditDetailPageState extends State<EquipmentInternalAudi
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Asset Information",
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
6.height,
'${context.translation.assetName}: ${model?.asset?.assetName ?? '-'}'.bodyText(context),
'${context.translation.assetNo}: ${model?.asset?.assetNumber ?? '-'}'.bodyText(context),
'${context.translation.serialNumber}: ${model?.asset?.assetNumber ?? '-'}'.bodyText(context),
'${context.translation.manufacture}: ${model?.asset?.manufacturerName ?? '-'}'.bodyText(context),
'${context.translation.model}: ${model?.asset?.modelName ?? '-'}'.bodyText(context),
'${context.translation.site}: ${model?.asset?.siteName ?? '-'}'.bodyText(context),
'${context.translation.department}: ${model?.asset?.departmentName ?? '-'}'.bodyText(context),
InfoHeader16Widget("Asset Information"),
InfoTextWidget(label: context.translation.assetName, value: model?.asset?.assetName ?? '-'),
InfoTextWidget(label: context.translation.assetNo, value: model?.asset?.assetNumber ?? '-'),
InfoTextWidget(label: context.translation.serialNumber, value: model?.asset?.assetNumber ?? '-'),
InfoTextWidget(label: context.translation.manufacture, value: model?.asset?.manufacturerName ?? '-'),
InfoTextWidget(label: context.translation.model, value: model?.asset?.modelName ?? '-'),
InfoTextWidget(label: context.translation.site, value: model?.asset?.siteName ?? '-'),
InfoTextWidget(label: context.translation.department, value: model?.asset?.departmentName ?? '-'),
],
);
}

@ -11,14 +11,15 @@ 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/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/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/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/app_loading.dart';
import 'package:test_sa/views/widgets/requests/request_status.dart';
@ -96,39 +97,26 @@ class _SystemInternalAuditDetailPageState extends State<SystemInternalAuditDetai
context,
model!.status!.name,
),
// textColor: AppColor.green15,
// backgroundColor: AppColor.greenStatus(context),
),
Text(
model!.createdDate!.toString().toServiceRequestCardFormat,
textAlign: TextAlign.end,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
)
InfoDateWidget(model!.createdDate?.toString() ?? ""),
],
),
8.height,
workOrderInfo(),
const Divider().defaultStyle(context),
8.height,
assetInfo(),
//TODO need to check for comments
if (model?.findingDescription?.isNotEmpty ?? false) ...[
const Divider().defaultStyle(context),
InfoHeader16Widget("Remarks"),
8.height,
Text(
"Remarks",
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
model!.findingDescription ?? '',
style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context)),
),
model!.findingDescription!.bodyText(context),
],
//TODO need to check for attachments
if (allAttachments.isNotEmpty) ...[
const Divider().defaultStyle(context),
Text(
"Attachments".addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
InfoHeader16Widget("Attachments".addTranslation),
FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.name ?? '') ?? '').toList() ?? []),
],
],
@ -189,16 +177,12 @@ class _SystemInternalAuditDetailPageState extends State<SystemInternalAuditDetai
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"WO Info",
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
6.height,
labelValueText(context, context.translation.requestNo, model?.requestNo),
labelValueText(context, 'WO Type'.addTranslation, model?.workOrderType?.name),
labelValueText(context, context.translation.woNumber, details?.workOrderNo),
labelValueText(context, "Finding Type", model?.findingType?.name),
labelValueText(context, "Assigned Engineer", model?.workOrderDetails?.woAssignedEngineer),
InfoHeader16Widget("WO Info"),
InfoTextWidget(label: context.translation.requestNo, value: model?.requestNo ?? '-'),
InfoTextWidget(label: 'WO Type'.addTranslation, value: model?.workOrderType?.name ?? '-'),
InfoTextWidget(label: context.translation.woNumber, value: details?.workOrderNo ?? '-'),
InfoTextWidget(label: "Finding Type", value: model?.findingType?.name ?? '-'),
InfoTextWidget(label: "Assigned Engineer", value: model?.workOrderDetails?.woAssignedEngineer ?? '-'),
],
);
}
@ -209,11 +193,7 @@ class _SystemInternalAuditDetailPageState extends State<SystemInternalAuditDetai
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider().defaultStyle(context),
Text(
"Request Details",
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
6.height,
InfoHeader16Widget("Request Details"),
checklistWidget(value: 'Asset Tag'.addTranslation),
checklistWidget(value: 'Expired PM Tag'.addTranslation),
],
@ -226,15 +206,11 @@ class _SystemInternalAuditDetailPageState extends State<SystemInternalAuditDetai
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Asset Details",
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
6.height,
labelValueText(context, context.translation.assetName, details?.woAssetName),
labelValueText(context, context.translation.assetNo, details?.woAssetNo),
labelValueText(context, context.translation.manufacture, details?.woManufacturer),
labelValueText(context, context.translation.model, details?.woModel),
InfoHeader16Widget("Asset Details"),
InfoTextWidget(label: context.translation.assetName, value: details?.woAssetName ?? '-'),
InfoTextWidget(label: context.translation.assetNo, value: details?.woAssetNo ?? '-'),
InfoTextWidget(label: context.translation.manufacture, value: details?.woManufacturer ?? '-'),
InfoTextWidget(label: context.translation.model, value: details?.woModel ?? '-'),
],
);
}
@ -245,18 +221,14 @@ class _SystemInternalAuditDetailPageState extends State<SystemInternalAuditDetai
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Asset Details",
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
6.height,
labelValueText(context, context.translation.assetName, details?.woAssetName),
labelValueText(context, context.translation.assetNo, details?.woAssetNo),
labelValueText(context, context.translation.manufacture, details?.woManufacturer),
labelValueText(context, context.translation.serialNumber, details?.wosn),
labelValueText(context, context.translation.model, details?.woModel),
labelValueText(context, context.translation.site, details?.woSite),
labelValueText(context, context.translation.department, details?.woDepartment),
InfoHeader16Widget("Asset Details"),
InfoTextWidget(label: context.translation.assetName, value: details?.woAssetName ?? '-'),
InfoTextWidget(label: context.translation.assetNo, value: details?.woAssetNo ?? '-'),
InfoTextWidget(label: context.translation.manufacture, value: details?.woManufacturer ?? '-'),
InfoTextWidget(label: context.translation.serialNumber, value: details?.wosn ?? '-'),
InfoTextWidget(label: context.translation.model, value: details?.woModel ?? '-'),
InfoTextWidget(label: context.translation.site, value: details?.woSite ?? '-'),
InfoTextWidget(label: context.translation.department, value: details?.woDepartment ?? '-'),
],
);
}

@ -17,11 +17,13 @@ import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/new_views/common_widgets/app_text_form_field.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/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';
import 'package:test_sa/views/widgets/requests/request_status.dart';
import '../models/loan_request_model.dart';
import 'installation_pullout_form_view.dart';
class LoanEquipmentDetailPage extends StatefulWidget {
static const String id = "/loan-equipment-detail-page";
@ -75,14 +77,10 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
backgroundColor: AppColor.getRequestStatusColorByName(context, snapshot.data!.loanStatusName!),
),
1.width.expanded,
Text(
snapshot.data!.createdDate?.toServiceRequestCardFormat ?? "-",
textAlign: TextAlign.end,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
),
InfoDateWidget(snapshot.data!.createdDate?.toString() ?? ""),
],
),
12.height,
8.height,
...requesterDetails(context, snapshot.data!),
const Divider().defaultStyle(context),
...requestDetails(context, snapshot.data!),
@ -96,10 +94,7 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
...vendorDetails(context, snapshot.data!),
if (allAttachments.isNotEmpty) ...[
const Divider().defaultStyle(context),
Text(
"Attachments".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
InfoHeader16Widget("Attachments".addTranslation),
FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
],
],
@ -187,64 +182,64 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
List<Widget> requestDetails(BuildContext context, LoanRequestModel loanData) {
return [
Text("Request Details", style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'Loan Type: ${loanData.loanTypeName ?? "-"}'.bodyText(context),
'Loan No: ${loanData.reqCode ?? "-"}'.bodyText(context),
'Loan Period: ${loanData.loanPeriodName ?? "-"}'.bodyText(context),
'${context.translation.site}: ${loanData.siteName ?? "-"}'.bodyText(context),
'${context.translation.department}: ${loanData.departmentName ?? "-"}'.bodyText(context),
'Item Description: ${loanData.itemDescription ?? "-"}'.bodyText(context),
'Request Description: ${loanData.requestDescription ?? "-"}'.bodyText(context),
InfoHeader16Widget("Request Details"),
InfoTextWidget(label: 'Loan Type', value: loanData.loanTypeName ?? "-"),
InfoTextWidget(label: 'Loan No', value: loanData.reqCode ?? "-"),
InfoTextWidget(label: 'Loan Period', value: loanData.loanPeriodName ?? "-"),
InfoTextWidget(label: context.translation.site, value: loanData.siteName ?? "-"),
InfoTextWidget(label: context.translation.department, value: loanData.departmentName ?? "-"),
InfoTextWidget(label: 'Item Description', value: loanData.itemDescription ?? "-"),
InfoTextWidget(label: 'Request Description', value: loanData.requestDescription ?? "-"),
];
}
List<Widget> vendorDetails(BuildContext context, LoanRequestModel loanData) {
return [
Text("Vendor Information", style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'Name: ${loanData.vendorName ?? "-"}'.bodyText(context),
'Representative Name: ${loanData.vendorRepName ?? "-"}'.bodyText(context),
'Contact: ${loanData.vendorContact ?? "-"}'.bodyText(context),
'Email: ${loanData.vendorEmail ?? "-"}'.bodyText(context),
InfoHeader16Widget("Vendor Information"),
InfoTextWidget(label: 'Name', value: loanData.vendorName ?? "-"),
InfoTextWidget(label: 'Representative Name', value: loanData.vendorRepName ?? "-"),
InfoTextWidget(label: 'Contact', value: loanData.vendorContact ?? "-"),
InfoTextWidget(label: 'Email', value: loanData.vendorEmail ?? "-"),
];
}
List<Widget> assetDetails(BuildContext context, LoanRequestModel loanData) {
return [
Text("Asset Information", style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'${context.translation.assetName}: ${loanData.assetName ?? "-"}'.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),
InfoHeader16Widget("Asset Information"),
InfoTextWidget(label: context.translation.assetName, value: loanData.assetName ?? "-"),
InfoTextWidget(label: context.translation.assetNo, value: loanData.assetNumber ?? "-"),
InfoTextWidget(label: context.translation.serialNumber, value: loanData.assetSerialNumber ?? "-"),
InfoTextWidget(label: context.translation.manufacture, value: loanData.manufacturer ?? "-"),
InfoTextWidget(label: context.translation.model, value: loanData.model ?? "-"),
];
}
List<Widget> installationDetails(BuildContext context, LoanRequestModel loanData) {
return [
Text("Installation & Pullout Information", style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'Installation EDD: ${loanData.installationEDD?.toServiceRequestDetailsFormat ?? "-"}'.bodyText(context),
'Installation Date: ${loanData.installationEDD?.toAssetDetailsFormat ?? "-"}'.bodyText(context),
'Pullout EDD: ${loanData.pulloutEDD?.toServiceRequestDetailsFormat ?? "-"}'.bodyText(context),
'Pullout Date: ${loanData.pulloutDate?.toAssetDetailsFormat ?? "-"}'.bodyText(context),
InfoHeader16Widget("Installation & Pullout Information"),
InfoTextWidget(label: 'Installation EDD', value: loanData.installationEDD?.toServiceRequestDetailsFormat ?? "-"),
InfoTextWidget(label: 'Installation Date', value: loanData.installationEDD?.toAssetDetailsFormat ?? "-"),
InfoTextWidget(label: 'Pullout EDD', value: loanData.pulloutEDD?.toServiceRequestDetailsFormat ?? "-"),
InfoTextWidget(label: 'Pullout Date', value: loanData.pulloutDate?.toAssetDetailsFormat ?? "-"),
];
}
List<Widget> doctorDetails(BuildContext context, LoanRequestModel loanData) {
return [
Text("Doctor Information", style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'Name: ${loanData.doctorName ?? "-"}'.bodyText(context),
'Contact: ${loanData.doctorContact ?? "-"}'.bodyText(context),
'Email: ${loanData.doctorEmail ?? "-"}'.bodyText(context),
InfoHeader16Widget("Doctor Information"),
InfoTextWidget(label: 'Name', value: loanData.doctorName ?? "-"),
InfoTextWidget(label: 'Contact', value: loanData.doctorContact ?? "-"),
InfoTextWidget(label: 'Email', value: loanData.doctorEmail ?? "-"),
];
}
List<Widget> requesterDetails(BuildContext context, LoanRequestModel loanData) {
return [
Text("Requester Information", style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'Name: ${loanData.requestorUserIdForDisplay ?? "-"}'.bodyText(context),
'Email: ${loanData.requestorUserEmail ?? "-"}'.bodyText(context),
'Contact: ${loanData.requestorUserMobileNumber ?? "-"}'.bodyText(context),
'Extension: ${loanData.requesterExtensionNo ?? "-"}'.bodyText(context),
InfoHeader16Widget("Requester Information"),
InfoTextWidget(label: 'Name', value: loanData.requestorUserIdForDisplay ?? "-"),
InfoTextWidget(label: 'Email', value: loanData.requestorUserEmail ?? "-"),
InfoTextWidget(label: 'Contact', value: loanData.requestorUserMobileNumber ?? "-"),
InfoTextWidget(label: 'Extension', value: loanData.requesterExtensionNo ?? "-"),
];
}

@ -15,6 +15,9 @@ 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/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';
import 'package:test_sa/views/widgets/requests/request_status.dart';
@ -82,32 +85,28 @@ class _MedicalGasInspectionDetailPageState extends State<MedicalGasInspectionDet
backgroundColor: AppColor.getHistoryLogStatusColorByName(model?.requestStatus?.name ?? ''),
),
1.width.expanded,
Text(model!.requestedDate!.toServiceRequestCardFormat,
textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50))
InfoDateWidget(model!.requestedDate?.toString() ?? ""),
],
),
8.height,
Text("Request Details", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'${context.translation.requestNo}: ${model?.requestNumber ?? '-'}'.bodyText(context),
'Requested by: ${model?.requestedBy ?? '-'}'.bodyText(context),
InfoHeader16Widget("Request Details"),
InfoTextWidget(label: context.translation.requestNo, value: model?.requestNumber ?? '-'),
InfoTextWidget(label: 'Requested by', value: model?.requestedBy ?? '-'),
if (model?.lastModifiedBy != null)
'Last Modified by: ${model?.lastModifiedBy ?? '-'}'.bodyText(context),
'Order Type: ${model?.requestOrderType ?? '-'}'.bodyText(context),
'Item Type: ${model?.itemType ?? '-'}'.bodyText(context),
'Site: ${model?.site ?? '-'}'.bodyText(context),
'Supplier Name: ${model?.supplier ?? '-'}'.bodyText(context),
'Supplier Contact: ${model?.contact ?? '-'}'.bodyText(context),
'Supplier Email: ${model?.email ?? '-'}'.bodyText(context),
InfoTextWidget(label: 'Last Modified by', value: model?.lastModifiedBy ?? '-'),
InfoTextWidget(label: 'Order Type', value: model?.requestOrderType ?? '-'),
InfoTextWidget(label: 'Item Type', value: model?.itemType ?? '-'),
InfoTextWidget(label: 'Site', value: model?.site ?? '-'),
InfoTextWidget(label: 'Supplier Name', value: model?.supplier ?? '-'),
InfoTextWidget(label: 'Supplier Contact', value: model?.contact ?? '-'),
InfoTextWidget(label: 'Supplier Email', value: model?.email ?? '-'),
if (model!.deliveryNoteAttachmentDto.isNotEmpty) ...[
const Divider().defaultStyle(context),
Text(
"Attachments".addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
InfoHeader16Widget("Attachments".addTranslation),
FilesList(images: model!.deliveryNoteAttachmentDto.map((e) => URLs.getFileUrl(e.name ?? '') ?? '').toList() ?? []),
],
],
).toShadowContainer(context, padding: 12),
).toShadowContainer(context, padding: 16),
],
).expanded,
if (model?.requestStatus?.value != null && model!.requestStatus!.value! < 3)

@ -9,6 +9,8 @@ import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/plan_preventive_visit/plan_preventive_visit_model.dart';
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.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/app_loading.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
import 'package:test_sa/views/widgets/requests/request_status.dart';
@ -73,40 +75,31 @@ class _PpmDetailsPageState extends State<PpmDetailsPage> {
children: [
Row(
children: [
// if (widget.request.priority != null)
// StatusLabel(
// label: widget.request.priority,
// textColor: AppColor.getRequestStatusTextColorByName(context, widget.request.priority!),
// backgroundColor: AppColor.getRequestStatusColorByName(context, widget.request.priority!),
// ),
// if (planPreventiveVisit?.visitStatus != null) 8.width,
StatusLabel(
label: planPreventiveVisit?.visitStatus!.name!,
id: planPreventiveVisit?.visitStatus?.id ?? 0,
label: planPreventiveVisit.visitStatus!.name!,
id: planPreventiveVisit.visitStatus?.id ?? 0,
textColor: AppColor.getRequestStatusTextColorByName(context, planPreventiveVisit.visitStatus!.name!),
backgroundColor: AppColor.getRequestStatusColorByName(context, planPreventiveVisit.visitStatus!.name!),
),
// 1.width.expanded,
],
),
8.height,
planPreventiveVisit.assetName!.cleanupWhitespace.capitalizeFirstOfEach.heading5(context).custom(color: AppColor.textStyleColor(context)),
InfoHeader16Widget(planPreventiveVisit.assetName?.cleanupWhitespace.capitalizeFirstOfEach??''),
8.height,
'${context.translation.assetNumber}: ${planPreventiveVisit.asset!.assetNumber}'.bodyText(context),
'${context.translation.assetSN}: ${planPreventiveVisit.asset!.assetSerialNo}'.bodyText(context),
'${context.translation.requestNo}: ${planPreventiveVisit.visitNo}'.bodyText(context),
InfoTextWidget(label: context.translation.assetNumber, value: planPreventiveVisit.asset?.assetNumber ?? '-'),
InfoTextWidget(label: context.translation.assetSN, value: planPreventiveVisit.asset?.assetSerialNo ?? '-'),
InfoTextWidget(label: context.translation.requestNo, value: planPreventiveVisit.visitNo ?? '-'),
const Divider().defaultStyle(context),
// '${context.translation.expectDate}: ${planPreventiveVisit.expectedDate?.toAssetDetailsFormat ?? ""}'.bodyText(context), //todo @baha,
'${context.translation.actualDate}: ${planPreventiveVisit.acutalDateOfVisit?.toIso8601String().toAssetDetailsFormat ?? ""}'.bodyText(context), //todo @baha,
InfoTextWidget(label: context.translation.actualDate, value: planPreventiveVisit.acutalDateOfVisit?.toIso8601String().toAssetDetailsFormat ?? ""),
const Divider().defaultStyle(context),
'${context.translation.assignedEmployee}: ${planPreventiveVisit.assignedEmployee?.userName ?? ""}'.bodyText(context), //todo @baha,
'${context.translation.site}: ${planPreventiveVisit.siteName?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context), //todo @baha,
'${context.translation.building}: ${planPreventiveVisit.buildingName?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context), //todo @baha,
'${context.translation.floor}: ${planPreventiveVisit.floorName?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context), //todo @baha,
'${context.translation.department}: ${planPreventiveVisit.departmentName?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context), //todo @baha,
'${context.translation.room}: ${(planPreventiveVisit.roomName ?? "").cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context), //todo @baha,
InfoTextWidget(label: context.translation.assignedEmployee, value: planPreventiveVisit.assignedEmployee?.userName ?? ""),
InfoTextWidget(label: context.translation.site, value: planPreventiveVisit.siteName?.cleanupWhitespace.capitalizeFirstOfEach ?? '-'),
InfoTextWidget(label: context.translation.building, value: planPreventiveVisit.buildingName?.cleanupWhitespace.capitalizeFirstOfEach ?? '-'),
InfoTextWidget(label: context.translation.floor, value: planPreventiveVisit.floorName?.cleanupWhitespace.capitalizeFirstOfEach ?? '-'),
InfoTextWidget(label: context.translation.department, value: planPreventiveVisit.departmentName?.cleanupWhitespace.capitalizeFirstOfEach ?? '-'),
InfoTextWidget(label: context.translation.room, value: (planPreventiveVisit.roomName ?? "").cleanupWhitespace.capitalizeFirstOfEach),
],
).toShadowContainer(context).paddingAll(16),
).toShadowContainer(context, padding: 16),
).expanded,
if (userProvider!.user!.type == UsersTypes.engineer && (!ppmProvider.isReadOnly)) ...[
FooterActionButton.footerContainer(

@ -11,6 +11,8 @@ import 'package:test_sa/modules/cm_module/cm_request_utils.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
import 'package:test_sa/new_views/common_widgets/working_time_tile.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/requests/request_status.dart';
import 'package:test_sa/views/widgets/timer/app_timer.dart';
@ -76,13 +78,12 @@ class _RecurrentTaskInfoWidgetState extends State<RecurrentTaskInfoWidget> {
backgroundColor: AppColor.getRequestStatusColorByName(context, widget.model?.status?.name),
),
8.height,
widget.model!.title!.bodyText(context).custom(color: AppColor.textColor(context)),
2.height,
'${context.translation.taskNo}: ${widget.model!.taskNo!}'.bodyText2(context).custom(color: AppColor.neutral120),
'Plan Name: ${widget.model?.planRecurrent?.planName ?? "-"}'.bodyText2(context).custom(color: AppColor.neutral120),
'${context.translation.site}: ${widget.model!.site!.siteName!}'.bodyText2(context).custom(color: AppColor.neutral120),
'${context.translation.assignedEmployee}: ${widget.model!.engineer!.userName ?? ""}'.bodyText2(context).custom(color: AppColor.neutral120),
'${context.translation.scheduledDate}: ${widget.model!.scheduleDate!.toMonthYearFormat}'.bodyText2(context).custom(color: AppColor.neutral120),
InfoHeader16Widget(widget.model!.title!),
InfoTextWidget(label: context.translation.taskNo, value: widget.model!.taskNo!),
InfoTextWidget(label: 'Plan Name:'.addTranslation, value: widget.model?.planRecurrent?.planName),
InfoTextWidget(label: context.translation.site, value: widget.model!.site!.siteName!),
InfoTextWidget(label: context.translation.assignedEmployee, value: widget.model!.engineer!.userName ?? ""),
InfoTextWidget(label: context.translation.scheduledDate, value: widget.model!.scheduleDate!.toMonthYearFormat),
],
).toShadowContainer(context),
12.height,

@ -14,6 +14,9 @@ import 'package:test_sa/modules/cx_module/chat/chat_widget.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/views/widgets/bottom_sheets/rejection_reason_bottom_sheet.dart';
import 'package:test_sa/views/widgets/images/files_list.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/app_loading.dart';
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
@ -85,51 +88,45 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
textColor: AppColor.getRequestStatusTextColorByName(context, _model?.transferType?.name),
backgroundColor: AppColor.getRequestStatusColorByName(context, _model?.transferType?.name),
),
Text(
_model?.createdOn != null ? _model!.createdOn!.toServiceRequestCardFormat : "",
textAlign: TextAlign.end,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
),
1.width.expanded,
InfoDateWidget(_model?.createdOn?.toString() ?? ""),
],
),
8.height,
context.translation.callDetails.heading6(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
_buildTextWidget('${context.translation.trNumber} : ${_model?.transferCode ?? "-"}'),
_buildTextWidget('${context.translation.createdBy} : ${_model?.name ?? "-"}'),
InfoHeader16Widget(context.translation.callDetails),
InfoTextWidget(label: context.translation.trNumber, value: _model?.transferCode ?? "-"),
InfoTextWidget(label: context.translation.createdBy, value: _model?.name ?? "-"),
const Divider().defaultStyle(context),
context.translation.assetInformation.heading6(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
_buildTextWidget('${context.translation.assetName} : ${_model?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? ""}'),
_buildTextWidget('${context.translation.assetNumber} : ${_model?.assetNumber ?? "-"}'),
_buildTextWidget('${context.translation.model} : ${_model?.modelName ?? "-"}'),
_buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo ?? "-"}'),
_buildTextWidget('${context.translation.site} : ${_model?.senderSiteName ?? "-"}'),
_buildTextWidget('${context.translation.building} : ${_model?.senderBuildingName ?? "-"}'),
_buildTextWidget('${context.translation.floor} : ${_model?.senderFloorName ?? "-"}'),
_buildTextWidget('${context.translation.department} : ${_model?.senderDepartmentName ?? "-"}'),
InfoHeader16Widget(context.translation.assetInformation),
InfoTextWidget(label: context.translation.assetName, value: _model?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? ""),
InfoTextWidget(label: context.translation.assetNumber, value: _model?.assetNumber ?? "-"),
InfoTextWidget(label: context.translation.model, value: _model?.modelName ?? "-"),
InfoTextWidget(label: context.translation.sn, value: _model?.assetSerialNo ?? "-"),
InfoTextWidget(label: context.translation.site, value: _model?.senderSiteName ?? "-"),
InfoTextWidget(label: context.translation.building, value: _model?.senderBuildingName ?? "-"),
InfoTextWidget(label: context.translation.floor, value: _model?.senderFloorName ?? "-"),
InfoTextWidget(label: context.translation.department, value: _model?.senderDepartmentName ?? "-"),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_contactPersonInfo(),
if ((_model?.comment ?? "").isNotEmpty) ...[
const Divider().defaultStyle(context),
context.translation.callComments.heading6(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
8.height,
_buildTextWidget(_model!.comment!),
InfoHeader16Widget(context.translation.callComments),
Text(
_model!.comment ?? '',
style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context)),
),
],
if (_attachments.isNotEmpty) ...[
const Divider().defaultStyle(context),
Text(
"Attachments".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
InfoHeader16Widget("Attachments".addTranslation),
FilesList(images: _model?.assetTransferAttachments?.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
//attachmentWidget(),
]
],
),
],
).toShadowContainer(context),
).toShadowContainer(context, padding: 16),
8.height,
if (_model?.transferType?.value == 1) ...[
_internalRequestDetailsCard()

@ -16,6 +16,9 @@ import 'package:test_sa/modules/cx_module/chat/chat_widget.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/views/widgets/bottom_sheets/rejection_reason_bottom_sheet.dart';
import 'package:test_sa/views/widgets/images/files_list.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/app_loading.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
import 'package:test_sa/views/widgets/requests/request_status.dart';
@ -112,49 +115,50 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
label: 'Assign To Me',
),
)
else if (_userProvider.user!.type == UsersTypes.engineer && (_model.status!.value! == 1)) ...[
FooterActionButton.footerContainer(
context: context,
child: Row(
children: [
AppFilledButton(
label: context.translation.cancel,
buttonColor: AppColor.white60,
textColor: AppColor.black10,
loading: false,
onPressed: () async {
context.showBottomSheet(
RejectionReasonBottomSheet(
onRejectPressed: (int reasonId, String comment) async {
await Future.delayed(const Duration(milliseconds: 500));
var data = await gasRefillProvider.engineerReject({"gasRefillId": _model.id!.toInt(), "rejectReasonId": reasonId, "rejectComment": comment});
isDataUpdated = data != null;
return isDataUpdated;
},
onRefreshed: () {
setState(() {});
},
),
title: "Rejection Reason".addTranslation);
},
).expanded,
16.width,
AppFilledButton(
onPressed: () async {
bool? isRefresh = await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateGasRefillRequest(gasRefillModel: _model)));
;
if (isRefresh != null && isRefresh) {
isDataUpdated = false;
setState(() {});
}
// getVisitData();
},
label: context.translation.updateRequest,
).expanded,
],
),
)
]
else
if (_userProvider.user!.type == UsersTypes.engineer && (_model.status!.value! == 1)) ...[
FooterActionButton.footerContainer(
context: context,
child: Row(
children: [
AppFilledButton(
label: context.translation.cancel,
buttonColor: AppColor.white60,
textColor: AppColor.black10,
loading: false,
onPressed: () async {
context.showBottomSheet(
RejectionReasonBottomSheet(
onRejectPressed: (int reasonId, String comment) async {
await Future.delayed(const Duration(milliseconds: 500));
var data = await gasRefillProvider.engineerReject({"gasRefillId": _model.id!.toInt(), "rejectReasonId": reasonId, "rejectComment": comment});
isDataUpdated = data != null;
return isDataUpdated;
},
onRefreshed: () {
setState(() {});
},
),
title: "Rejection Reason".addTranslation);
},
).expanded,
16.width,
AppFilledButton(
onPressed: () async {
bool? isRefresh = await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateGasRefillRequest(gasRefillModel: _model)));
;
if (isRefresh != null && isRefresh) {
isDataUpdated = false;
setState(() {});
}
// getVisitData();
},
label: context.translation.updateRequest,
).expanded,
],
),
)
]
//TODO need to uncomment this to enable nurse edit gas refill request.
// else if (_model.status!.value! == 0) ...[
// AppFilledButton(
@ -191,13 +195,6 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
children: [
Row(
children: [
// if (widget.priority != null)
// StatusLabel(
// label: widget.priority,
// textColor: AppColor.getRequestStatusTextColorByName(context, widget.priority!),
// backgroundColor: AppColor.getRequestStatusColorByName(context, widget.priority!),
// ),
// 8.width,
StatusLabel(
label: gasRefillModel.status?.name ?? "",
textColor: AppColor.getRequestStatusTextColorByName(context, gasRefillModel.status?.name ?? ""),
@ -206,64 +203,45 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
],
),
8.height,
context.translation.callDetails.heading6(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
infoText(label: context.translation.requestNo, value: gasRefillModel.gasRefillNo),
infoText(label: context.translation.createdBy, value: gasRefillModel.name),
infoText(label: context.translation.gasType, value: gasRefillModel.gasRefillDetails?[0].gasType?.name),
infoText(label: context.translation.cylinderType, value: gasRefillModel.gasRefillDetails?[0].cylinderType?.name),
infoText(label: context.translation.cylinderSize, value: gasRefillModel.gasRefillDetails?[0].cylinderSize?.name),
infoText(label: context.translation.site, value: gasRefillModel.site?.name?.cleanupWhitespace.capitalizeFirstOfEach),
infoText(label: context.translation.building, value: gasRefillModel.building?.name),
infoText(label: context.translation.floor, value: gasRefillModel.floor?.name),
infoText(label: context.translation.department, value: gasRefillModel.department?.name),
infoText(label: context.translation.requestedQuantity, value: gasRefillModel.gasRefillDetails?[0].requestedQty.toString()),
InfoHeader16Widget(context.translation.callDetails),
InfoTextWidget(label: context.translation.requestNo, value: gasRefillModel.gasRefillNo ?? '-'),
InfoTextWidget(label: context.translation.createdBy, value: gasRefillModel.name ?? '-'),
InfoTextWidget(label: context.translation.gasType, value: gasRefillModel.gasRefillDetails?[0].gasType?.name ?? '-'),
InfoTextWidget(label: context.translation.cylinderType, value: gasRefillModel.gasRefillDetails?[0].cylinderType?.name ?? '-'),
InfoTextWidget(label: context.translation.cylinderSize, value: gasRefillModel.gasRefillDetails?[0].cylinderSize?.name ?? '-'),
InfoTextWidget(label: context.translation.site, value: gasRefillModel.site?.name?.cleanupWhitespace.capitalizeFirstOfEach ?? '-'),
InfoTextWidget(label: context.translation.building, value: gasRefillModel.building?.name ?? '-'),
InfoTextWidget(label: context.translation.floor, value: gasRefillModel.floor?.name ?? '-'),
InfoTextWidget(label: context.translation.department, value: gasRefillModel.department?.name ?? '-'),
InfoTextWidget(label: context.translation.requestedQuantity, value: gasRefillModel.gasRefillDetails?[0].requestedQty?.toString() ?? '-'),
_contactPersonInfo(),
if (gasRefillModel.gasRefillDetails?[0].deliverdQty != null) ...[
const Divider().defaultStyle(context),
context.translation.workOrderDetails.heading6(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
infoText(label: context.translation.deliveredQuantity, value: gasRefillModel.gasRefillDetails![0].deliverdQty.toString()),
InfoHeader16Widget(context.translation.workOrderDetails),
InfoTextWidget(label: context.translation.deliveredQuantity, value: gasRefillModel.gasRefillDetails![0].deliverdQty?.toString() ?? '-'),
],
if (gasRefillModel.techComment?.isNotEmpty ?? false) infoText(label: context.translation.technicalComment, value: gasRefillModel.techComment),
8.height,
if (gasRefillModel.techComment?.isNotEmpty ?? false)
InfoTextWidget(label: context.translation.technicalComment, value: gasRefillModel.techComment ?? '-'),
if (gasRefillModel.comment?.isNotEmpty ?? false) ...[
const Divider().defaultStyle(context),
InfoHeader16Widget("Comments".addTranslation),
Text(
"Comments".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
gasRefillModel.comment ?? '',
style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context)),
),
gasRefillModel.comment!.bodyText(context),
8.height,
],
// if (gasRefillModel.techComment?.isNotEmpty ?? false) ...[
// const Divider().defaultStyle(context),
// Text(
// "Technical Comments".addTranslation,
// style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
// ),
// gasRefillModel.techComment!.bodyText(context),
// 8.height,
// ],
if (_attachments.isNotEmpty) ...[
const Divider().defaultStyle(context),
Text(
"Attachments".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
InfoHeader16Widget("Attachments".addTranslation),
FilesList(images: _model.gasRefillAttachments?.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
],
],
).expanded,
if (_userProvider.user!.type == UsersTypes.engineer && (gasRefillModel.status?.value ?? 0) != 2) 8.height,
Text(
(widget.date ?? gasRefillModel.expectedDate)?.toServiceRequestCardFormat ?? "",
textAlign: TextAlign.end,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
),
InfoDateWidget((widget.date ?? gasRefillModel.expectedDate)?.toString() ?? ""),
],
).paddingOnly(top: 16, start: 16, end: 16),
),
],
).toShadowContainer(context, padding: 0);
).toShadowContainer(context, padding: 16);
}
Widget _contactPersonInfo() {
@ -272,12 +250,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider().defaultStyle(context),
Text(
"Contact Info".addTranslation,
style: AppTextStyles.heading6.copyWith(
color: context.isDark ? AppColor.neutral30 : AppColor.neutral50,
),
),
InfoHeader16Widget("Contact Info".addTranslation),
..._model.gasRefillContactPerson!.asMap().entries.map((entry) {
final index = entry.key;
final person = entry.value;
@ -286,12 +259,11 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 8),
infoText(label: context.translation.employeeId, value: person.employeeCode),
infoText(label: context.translation.name, value: person.name),
infoText(label: context.translation.email, value: person.email),
infoText(label: context.translation.phoneNumber, value: person.mobilePhone),
infoText(label: context.translation.extensionNo, value: person.extension),
InfoTextWidget(label: context.translation.employeeId, value: person.employeeCode ?? '-'),
InfoTextWidget(label: context.translation.name, value: person.name ?? '-'),
InfoTextWidget(label: context.translation.email, value: person.email ?? '-'),
InfoTextWidget(label: context.translation.phoneNumber, value: person.mobilePhone ?? '-'),
InfoTextWidget(label: context.translation.extensionNo, value: person.extension ?? '-'),
if (!isLast && _model.gasRefillContactPerson!.length > 1) const Divider().defaultStyle(context),
],
);
@ -302,14 +274,4 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
return const SizedBox();
}
Widget infoText({
String? label,
String? value,
}) {
if (value == null || value.isEmpty || value.toLowerCase() == 'null') {
return const SizedBox();
} else {
return '$label: $value'.bodyText(context);
}
}
}
}

@ -18,6 +18,9 @@ import 'package:test_sa/new_views/common_widgets/working_time_tile.dart';
import 'package:test_sa/providers/task_request_provider/task_request_provider.dart';
import 'package:test_sa/views/widgets/bottom_sheets/rejection_reason_bottom_sheet.dart';
import 'package:test_sa/views/widgets/images/files_list.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/app_loading.dart';
import 'package:test_sa/views/widgets/requests/request_status.dart';
import 'package:test_sa/views/widgets/total_working_time_detail_bottomsheet.dart';
@ -118,64 +121,51 @@ class _TaskRequestDetailsViewState extends State<TaskRequestDetailsView> {
backgroundColor: AppColor.getRequestStatusColorByName(context, taskModel?.taskJobStatus?.name ?? widget.requestDetails?.status!),
),
1.width.expanded,
Text(
widget.requestDetails?.date?.toServiceRequestCardFormat ?? "-",
textAlign: TextAlign.end,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
),
InfoDateWidget(widget.requestDetails?.date?.toString() ?? ""),
],
),
8.height,
if (taskProvider.taskRequestModel?.taskType?.relatedTo?.value == 1) ...[
assetDetails(taskModel: taskProvider.taskRequestModel!),
],
if (taskProvider.taskRequestModel?.taskType?.isInstallation == true) ...[installationWidget(taskModel: taskProvider.taskRequestModel!)],
if (taskProvider.taskRequestModel?.taskType?.isInstallation == true) ...[
const Divider().defaultStyle(context),
installationWidget(taskModel: taskProvider.taskRequestModel!)
],
if (taskProvider.taskRequestModel?.taskType?.relatedTo?.value == 2) ...[
const Divider().defaultStyle(context),
linkWithLocationWidget(taskModel: taskProvider.taskRequestModel!),
],
const Divider().defaultStyle(context),
Text(
"Task Details".addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
'${context.translation.taskType}: ${taskModel?.taskType?.typeName ?? "-"}'.bodyText(context),
'${context.translation.taskNo}: ${taskModel?.taskJobNo ?? "-"}'.bodyText(context),
'${context.translation.createdBy}: ${taskModel?.userCreated?.userName ?? "-"}'.bodyText(context),
InfoHeader16Widget("Task Details".addTranslation),
InfoTextWidget(label: context.translation.taskType, value: taskModel?.taskType?.typeName ?? "-"),
InfoTextWidget(label: context.translation.taskNo, value: taskModel?.taskJobNo ?? "-"),
InfoTextWidget(label: context.translation.createdBy, value: taskModel?.userCreated?.userName ?? "-"),
if (taskProvider.taskRequestModel?.taskType?.isRecallAndAlert == true) ...[
recallAlertTypeWidget(taskModel: taskProvider.taskRequestModel!),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'Type of alert: ${taskProvider.taskRequestModel?.typeOfAlert?.name ?? '-'}'.bodyText(context),
'Risk Level: ${taskProvider.taskRequestModel?.riskLevel?.name ?? '-'}'.bodyText(context),
'Resource: ${taskProvider.taskRequestModel?.resource?.name ?? '-'}'.bodyText(context),
'Evaluator User: ${taskProvider.taskRequestModel?.evaluatorUser?.userName ?? '-'}'.bodyText(context)
],
),
InfoTextWidget(label: 'Type of alert', value: taskProvider.taskRequestModel?.typeOfAlert?.name ?? '-'),
InfoTextWidget(label: 'Risk Level', value: taskProvider.taskRequestModel?.riskLevel?.name ?? '-'),
InfoTextWidget(label: 'Resource', value: taskProvider.taskRequestModel?.resource?.name ?? '-'),
InfoTextWidget(label: 'Evaluator User', value: taskProvider.taskRequestModel?.evaluatorUser?.userName ?? '-'),
],
showWorkingTime(taskModel?.taskJobActivityEngineerTimers ?? []),
if ((taskProvider.taskRequestModel?.taskJobContactPersons ?? []).isNotEmpty) ...[contactInfoCard(context, taskProvider.taskRequestModel!)],
if (taskProvider.taskRequestModel?.callComment != null) ...[
const Divider().defaultStyle(context),
InfoHeader16Widget(context.translation.comment),
Text(
context.translation.comment,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
taskProvider.taskRequestModel!.callComment ?? '',
style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context)),
),
2.height,
taskProvider.taskRequestModel!.callComment!.bodyText(context),
],
if (taskProvider.taskRequestModel?.taskJobAttachments?.isNotEmpty ?? false) ...[
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: taskProvider.taskRequestModel!.taskJobAttachments!.map((toElement) => URLs.getFileUrl(toElement.name ?? '') ?? '').toList()),
],
buildTechnicalComments(taskModel: taskModel),
],
).toShadowContainer(context).paddingAll(16),
).toShadowContainer(context, padding: 16),
).expanded,
if (taskProvider.taskRequestModel?.taskType?.isRecallAndAlert == false &&
context.settingProvider.isUserFlowMedical &&
@ -291,13 +281,8 @@ class _TaskRequestDetailsViewState extends State<TaskRequestDetailsView> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
8.height,
const Divider().defaultStyle(context),
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,
@ -305,11 +290,11 @@ class _TaskRequestDetailsViewState extends State<TaskRequestDetailsView> {
itemBuilder: (cxt, index) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'${context.translation.name}: ${taskModel.taskJobContactPersons?[index].user?.userName ?? '-'}'.bodyText(context),
'${context.translation.employeeId}: ${taskModel.taskJobContactPersons?[index].user?.employeeId ?? '-'}'.bodyText(context),
'${context.translation.telephone}: ${taskModel.taskJobContactPersons?[index].user?.phoneNumber ?? '-'}'.bodyText(context),
'${context.translation.email}: ${taskModel.taskJobContactPersons?[index].user?.email ?? '-'}'.bodyText(context),
'Extension: ${taskModel.taskJobContactPersons?[index].user?.extensionNo ?? '-'}'.bodyText(context),
InfoTextWidget(label: context.translation.name, value: taskModel.taskJobContactPersons?[index].user?.userName ?? '-'),
InfoTextWidget(label: context.translation.employeeId, value: taskModel.taskJobContactPersons?[index].user?.employeeId ?? '-'),
InfoTextWidget(label: context.translation.telephone, value: taskModel.taskJobContactPersons?[index].user?.phoneNumber ?? '-'),
InfoTextWidget(label: context.translation.email, value: taskModel.taskJobContactPersons?[index].user?.email ?? '-'),
InfoTextWidget(label: 'Extension', value: taskModel.taskJobContactPersons?[index].user?.extensionNo ?? '-'),
],
),
separatorBuilder: (cxt, index) => const Divider().defaultStyle(context),
@ -322,18 +307,13 @@ class _TaskRequestDetailsViewState extends State<TaskRequestDetailsView> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider().defaultStyle(context),
Text(
"Site Details".addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
'${context.translation.installationSite}: ${taskModel.asset?.siteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"}'.bodyText(context),
'${context.translation.installationBuilding}: ${taskModel.installationBuilding?.name?.cleanupWhitespace.capitalizeFirstOfEach ?? '-'}'.bodyText(context),
'${context.translation.installationFloor}: ${taskModel.installationFloor?.name?.cleanupWhitespace.capitalizeFirstOfEach ?? '-'}'.bodyText(context),
'${context.translation.installationDepartment}: ${taskModel.installationDepartment?.name?.cleanupWhitespace.capitalizeFirstOfEach ?? '-'}'.bodyText(context),
'${context.translation.installationDate}: ${taskModel.installationDate?.toAssetDetailsFormat ?? "-"}'.bodyText(context),
'${context.translation.serialNo}: ${taskModel.serialNo ?? '-'}'.bodyText(context),
// const Divider().defaultStyle(context),
InfoHeader16Widget("Site Details".addTranslation),
InfoTextWidget(label: context.translation.installationSite, value: taskModel.asset?.siteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"),
InfoTextWidget(label: context.translation.installationBuilding, value: taskModel.installationBuilding?.name?.cleanupWhitespace.capitalizeFirstOfEach ?? '-'),
InfoTextWidget(label: context.translation.installationFloor, value: taskModel.installationFloor?.name?.cleanupWhitespace.capitalizeFirstOfEach ?? '-'),
InfoTextWidget(label: context.translation.installationDepartment, value: taskModel.installationDepartment?.name?.cleanupWhitespace.capitalizeFirstOfEach ?? '-'),
InfoTextWidget(label: context.translation.installationDate, value: taskModel.installationDate?.toAssetDetailsFormat ?? "-"),
InfoTextWidget(label: context.translation.serialNo, value: taskModel.serialNo ?? '-'),
],
);
}
@ -345,12 +325,11 @@ class _TaskRequestDetailsViewState extends State<TaskRequestDetailsView> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider().defaultStyle(context),
InfoHeader16Widget("Technical Comments".addTranslation),
Text(
"Technical Comments".addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
previousComments,
style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context)),
),
previousComments.bodyText2(context).custom(color: AppColor.neutral50),
8.height,
],
);
}
@ -362,15 +341,12 @@ class _TaskRequestDetailsViewState extends State<TaskRequestDetailsView> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Location Details".addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
'${context.translation.site}: ${taskModel.site?.name ?? "-"}'.bodyText(context),
'${context.translation.building}: ${taskModel.building?.name ?? "-"}'.bodyText(context),
'${context.translation.floor}: ${taskModel.floor?.name ?? "-"}'.bodyText(context),
'${context.translation.department}: ${taskModel.department?.name ?? "-"}'.bodyText(context),
'${context.translation.room}: ${taskModel.room?.name ?? "-"}'.bodyText(context),
InfoHeader16Widget("Location Details".addTranslation),
InfoTextWidget(label: context.translation.site, value: taskModel.site?.name ?? "-"),
InfoTextWidget(label: context.translation.building, value: taskModel.building?.name ?? "-"),
InfoTextWidget(label: context.translation.floor, value: taskModel.floor?.name ?? "-"),
InfoTextWidget(label: context.translation.department, value: taskModel.department?.name ?? "-"),
InfoTextWidget(label: context.translation.room, value: taskModel.room?.name ?? "-"),
],
);
}
@ -381,24 +357,21 @@ class _TaskRequestDetailsViewState extends State<TaskRequestDetailsView> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
context.translation.assetDetails,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
'${context.translation.assetName}: ${taskModel.asset?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"}'.bodyText(context),
'${context.translation.assetNo}: ${taskModel.asset?.assetNumber ?? "-"}'.bodyText(context),
'${context.translation.manufacture}: ${taskModel.asset?.manufacturer ?? "-"}'.bodyText(context),
'${context.translation.model}: ${taskModel.asset?.model ?? "-"}'.bodyText(context),
'${context.translation.serialNo}: ${taskModel.asset?.serialNo ?? "-"}'.bodyText(context),
'${context.translation.assetType}: ${taskModel.asset?.assetTypeName ?? "-"}'.bodyText(context),
'${context.translation.site}: ${taskModel.asset?.siteName ?? "-"}'.bodyText(context),
'${context.translation.building}: ${taskModel.asset?.buildingName ?? "-"}'.bodyText(context),
'${context.translation.floor}: ${taskModel.asset?.floorName ?? "-"}'.bodyText(context),
'${context.translation.department}: ${taskModel.asset?.departmentName ?? "-"}'.bodyText(context),
'${context.translation.room}: ${taskModel.asset?.roomName ?? "-"}'.bodyText(context),
'${context.translation.supplier}: ${taskModel.asset?.supplierName ?? "-"}'.bodyText(context),
'PO Number: ${taskModel.asset?.poNumber ?? "-"}'.bodyText(context),
'${context.translation.installationDate}: ${taskModel.asset?.installationDate?.toAssetDetailsFormat ?? "-"}'.bodyText(context),
InfoHeader16Widget(context.translation.assetDetails),
InfoTextWidget(label: context.translation.assetName, value: taskModel.asset?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"),
InfoTextWidget(label: context.translation.assetNo, value: taskModel.asset?.assetNumber ?? "-"),
InfoTextWidget(label: context.translation.manufacture, value: taskModel.asset?.manufacturer ?? "-"),
InfoTextWidget(label: context.translation.model, value: taskModel.asset?.model ?? "-"),
InfoTextWidget(label: context.translation.serialNo, value: taskModel.asset?.serialNo ?? "-"),
InfoTextWidget(label: context.translation.assetType, value: taskModel.asset?.assetTypeName ?? "-"),
InfoTextWidget(label: context.translation.site, value: taskModel.asset?.siteName ?? "-"),
InfoTextWidget(label: context.translation.building, value: taskModel.asset?.buildingName ?? "-"),
InfoTextWidget(label: context.translation.floor, value: taskModel.asset?.floorName ?? "-"),
InfoTextWidget(label: context.translation.department, value: taskModel.asset?.departmentName ?? "-"),
InfoTextWidget(label: context.translation.room, value: taskModel.asset?.roomName ?? "-"),
InfoTextWidget(label: context.translation.supplier, value: taskModel.asset?.supplierName ?? "-"),
InfoTextWidget(label: 'PO Number', value: taskModel.asset?.poNumber ?? "-"),
InfoTextWidget(label: context.translation.installationDate, value: taskModel.asset?.installationDate?.toAssetDetailsFormat ?? "-"),
],
)
: const SizedBox();
@ -408,16 +381,15 @@ class _TaskRequestDetailsViewState extends State<TaskRequestDetailsView> {
if (taskModel.typeOfAlert != null) {
switch (taskModel.typeOfAlert!.value) {
case 1:
return '${context.translation.acknowledge}: ${taskModel.isUserAcknowledge ?? "-"}'.bodyText(context);
return InfoTextWidget(label: context.translation.acknowledge, value: taskModel.isUserAcknowledge?.toString() ?? "-");
case 2:
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// assetDetails(taskModel: taskModel),
'${context.translation.completedActions}: ${taskModel.actionNeeded?.name ?? "-"}'.bodyText(context),
InfoTextWidget(label: context.translation.completedActions, value: taskModel.actionNeeded?.name ?? "-"),
if (taskModel.actionNeeded?.value == 1) ...[
'${context.translation.impactStatus}: ${taskModel.impactStatus?.name ?? "-"}'.bodyText(context),
InfoTextWidget(label: context.translation.impactStatus, value: taskModel.impactStatus?.name ?? "-"),
],
],
);
@ -427,9 +399,8 @@ class _TaskRequestDetailsViewState extends State<TaskRequestDetailsView> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// assetDetails(taskModel: taskModel),
'${context.translation.acknowledge}: ${taskModel.isUserAcknowledge ?? "-"}'.bodyText(context),
'${context.translation.completedActions}: ${taskModel.actionNeeded?.name ?? "-"}'.bodyText(context),
InfoTextWidget(label: context.translation.acknowledge, value: taskModel.isUserAcknowledge?.toString() ?? "-"),
InfoTextWidget(label: context.translation.completedActions, value: taskModel.actionNeeded?.name ?? "-"),
if (taskModel.actionNeeded?.value == 1) ...[
'${context.translation.impactStatus}: ${taskModel.impactStatus?.name ?? "-"}'.bodyText(context),
],

@ -3,17 +3,15 @@ import 'package:provider/provider.dart';
import 'package:test_sa/controllers/providers/api/user_provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/enums/user_types.dart';
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
import 'package:test_sa/modules/traf_module/traf_request_provider.dart';
import 'package:test_sa/modules/traf_module/update_traf_request_page.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/loaders/app_loading.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.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 'asset_analytics_model.dart';
import 'traf_request_model.dart';
@ -61,9 +59,9 @@ class _TrafRequestDetailPageState extends State<TrafRequestDetailPage> {
padding: const EdgeInsets.all(16),
children: [
requesterInformation(trafProvider.trafRequestDataModel!),
12.height,
16.height,
requestInformation(trafProvider.trafRequestDataModel!),
12.height,
16.height,
assetInformation(trafProvider.trafRequestDataModel!),
],
).expanded,
@ -88,22 +86,17 @@ class _TrafRequestDetailPageState extends State<TrafRequestDetailPage> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Requester Information",
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
'${context.translation.employeeId}: ${data.employeeIdForDisplay ?? '-'}'.bodyText(context),
'${context.translation.name}: ${data.employeeName ?? '-'}'.bodyText(context),
'${context.translation.email}: ${data.employeeEmail ?? '-'}'.bodyText(context),
'Position: ${data.positionName ?? '-'}'.bodyText(context),
'${context.translation.site}: ${data.siteName ?? '-'}'.bodyText(context),
'${context.translation.department}: ${data.departmentName}'.bodyText(context),
// 'Requester Extension: ${data.requesterExtensionName ?? '-'}'.bodyText(context),
'Number/Contact Information: ${data.requesterContactNumber ?? '-'}'.bodyText(context),
'Extension: ${data.requesterExtensionNumber ?? '-'}'.bodyText(context),
InfoHeader16Widget("Requester Information".addTranslation),
InfoTextWidget(label: context.translation.employeeId, value: data.employeeIdForDisplay ?? '-'),
InfoTextWidget(label: context.translation.name, value: data.employeeName ?? '-'),
InfoTextWidget(label: context.translation.email, value: data.employeeEmail ?? '-'),
InfoTextWidget(label: 'Position'.addTranslation, value: data.positionName ?? '-'),
InfoTextWidget(label: context.translation.site, value: data.siteName ?? '-'),
InfoTextWidget(label: context.translation.department, value: data.departmentName ?? '-'),
InfoTextWidget(label: 'Number/Contact Information'.addTranslation, value: data.requesterContactNumber ?? '-'),
InfoTextWidget(label: 'Extension'.addTranslation, value: data.requesterExtensionNumber ?? '-'),
],
).toShadowContainer(context, borderRadius: 20, padding: 12);
).toShadowContainer(context, borderRadius: 20, padding: 16);
}
Widget requestInformation(TrafRequestDataModel data) {
@ -111,45 +104,32 @@ class _TrafRequestDetailPageState extends State<TrafRequestDetailPage> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Request Information",
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
'TRAF No: ${data.reqCode ?? '-'}'.bodyText(context),
'Request type: ${data.requestTypeName ?? '-'}'.bodyText(context),
4.height,
'How would the requested technology solve the current situation and/or serve the purpose?: ${data.purposeAnswer ?? '-'}'.bodyText(context),
4.height,
'What is the current practice?: ${data.currentPractise ?? '-'}'.bodyText(context),
4.height,
'Census Q1: ${data.censusQ1 ?? '-'}'.bodyText(context),
'Census Q2: ${data.censusQ2 ?? '-'}'.bodyText(context),
'Census Q3: ${data.censusQ3 ?? '-'}'.bodyText(context),
'Census Q4: ${data.censusQ4 ?? '-'}'.bodyText(context),
4.height,
'List down names & contact information of users going to use the technology & specify if they are part-time or full time?:\n${data.trafContacts?.map((item) => item.name).toList() ?? '-'}'
.bodyText(context),
4.height,
'Is the requesting department going to use the technology solely or shared with other departments?:\n${data.usingSolelyOrSharedName ?? '-'}'.bodyText(context),
InfoHeader16Widget("Request Information"),
InfoTextWidget(label: 'TRAF No', value: data.reqCode ?? '-'),
InfoTextWidget(label: 'Request type', value: data.requestTypeName ?? '-'),
InfoTextWidget(label: 'How would the requested technology solve the current situation and/or serve the purpose?', value: data.purposeAnswer ?? '-'),
InfoTextWidget(label: 'What is the current practice?', value: data.currentPractise ?? '-'),
InfoTextWidget(label: 'Census Q1', value: data.censusQ1 ?? '-'),
InfoTextWidget(label: 'Census Q2', value: data.censusQ2 ?? '-'),
InfoTextWidget(label: 'Census Q3', value: data.censusQ3 ?? '-'),
InfoTextWidget(label: 'Census Q4', value: data.censusQ4 ?? '-'),
InfoTextWidget(
label: 'List down names & contact information of users going to use the technology & specify if they are part-time or full time?',
value: data.trafContacts?.map((item) => item.name).toList().toString() ?? '-'),
InfoTextWidget(label: 'Is the requesting department going to use the technology solely or shared with other departments?', value: data.usingSolelyOrSharedName ?? '-'),
if ((data.departments ?? []).isNotEmpty) ...[
4.height,
'Technology used with other departments:\n${data.departments?.map((item) => item.departmentName).toList() ?? '-'}'.bodyText(context),
InfoTextWidget(label: 'Technology used with other departments', value: data.departments?.map((item) => item.departmentName).toList().toString() ?? '-'),
],
4.height,
'Would other services be effected by acquiring the new equipment?:\n${data.isEffectedName ?? '-'}'.bodyText(context),
InfoTextWidget(label: 'Would other services be effected by acquiring the new equipment?', value: data.isEffectedName ?? '-'),
if ((data.effectedServices ?? "").isNotEmpty) ...[
4.height,
'List of services would it be effected:\n${data.effectedServices ?? '-'}'.bodyText(context),
InfoTextWidget(label: 'List of services would it be effected', value: data.effectedServices ?? '-'),
],
4.height,
'Is the equipment going to be used with combination of other equipment to accomplish a specific procedure?:\n${data.isCombinationName ?? '-'}'.bodyText(context),
InfoTextWidget(label: 'Is the equipment going to be used with combination of other equipment to accomplish a specific procedure?', value: data.isCombinationName ?? '-'),
if ((data.usedWithCombination ?? "").isNotEmpty) ...[
4.height,
'Equipment going to be used with combination of other equipments:\n${data.usedWithCombination ?? '-'}'.bodyText(context),
InfoTextWidget(label: 'Equipment going to be used with combination of other equipments', value: data.usedWithCombination ?? '-'),
],
],
).toShadowContainer(context, borderRadius: 20, padding: 12);
).toShadowContainer(context, borderRadius: 20, padding: 16);
}
Widget assetInformation(TrafRequestDataModel data) {
@ -157,14 +137,10 @@ class _TrafRequestDetailPageState extends State<TrafRequestDetailPage> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Asset Information",
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
'${context.translation.assetName}: ${data.assetName ?? '-'}'.bodyText(context),
'${context.translation.model}: ${data.modelName ?? '-'}'.bodyText(context),
'${context.translation.manufacture}: ${data.manufacturerName ?? '-'}'.bodyText(context),
InfoHeader16Widget("Asset Information"),
InfoTextWidget(label: context.translation.assetName, value: data.assetName ?? '-'),
InfoTextWidget(label: context.translation.model, value: data.modelName ?? '-'),
InfoTextWidget(label: context.translation.manufacture, value: data.manufacturerName ?? '-'),
if (data.requestTypeId == 733) ...[
FutureBuilder<AssetAnalytics?>(
future: Provider.of<TrafRequestProvider>(context, listen: false).getAssetAnalytics(data.assetId!),
@ -174,23 +150,23 @@ class _TrafRequestDetailPageState extends State<TrafRequestDetailPage> {
}
if (snapshot.hasData) {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
'Last price: ${snapshot.data?.lastPrice ?? '-'}'.bodyText(context),
'PO: ${snapshot.data?.lastPONo ?? '-'}'.bodyText(context),
'The quantity of the same asset: ${snapshot.data?.sameAssetQuantity ?? '-'}'.bodyText(context), // todo check with shaheer
'Existing asset under SLA: ${snapshot.data?.slaStatus ?? '-'}'.bodyText(context), // todo check with shaheer
'Age of the asset: ${snapshot.data?.assetAgeDescription ?? '-'}'.bodyText(context), // todo check with shaheer
'Total Maintenance Cost (TMC): ${snapshot.data?.totalMaintenanceCost ?? '-'}'.bodyText(context), // todo check with shaheer
'Net Book Value (NBV): ${snapshot.data?.netBookValue ?? '-'}'.bodyText(context), // todo check with shaheer
'Mean Time Between Failure (MTBF): ${snapshot.data?.mtbfDescription ?? '-'}'.bodyText(context), // todo check with shaheer
'Down Time (DT): ${snapshot.data?.downTimeDescription ?? '-'}'.bodyText(context), // todo check with shaheer
'Up Time (UT): ${snapshot.data?.upTimeDescription ?? '-'}'.bodyText(context),
'Purchased Price: ${snapshot.data?.purchasedPrice ?? '-'}'.bodyText(context),
InfoTextWidget(label: 'Last price', value: snapshot.data?.lastPrice?.toString() ?? '-'),
InfoTextWidget(label: 'PO', value: snapshot.data?.lastPONo ?? '-'),
InfoTextWidget(label: 'The quantity of the same asset', value: snapshot.data?.sameAssetQuantity?.toString() ?? '-'),
InfoTextWidget(label: 'Existing asset under SLA', value: snapshot.data?.slaStatus ?? '-'),
InfoTextWidget(label: 'Age of the asset', value: snapshot.data?.assetAgeDescription ?? '-'),
InfoTextWidget(label: 'Total Maintenance Cost (TMC)', value: snapshot.data?.totalMaintenanceCost?.toString() ?? '-'),
InfoTextWidget(label: 'Net Book Value (NBV)', value: snapshot.data?.netBookValue?.toString() ?? '-'),
InfoTextWidget(label: 'Mean Time Between Failure (MTBF)', value: snapshot.data?.mtbfDescription ?? '-'),
InfoTextWidget(label: 'Down Time (DT)', value: snapshot.data?.downTimeDescription ?? '-'),
InfoTextWidget(label: 'Up Time (UT)', value: snapshot.data?.upTimeDescription ?? '-'),
InfoTextWidget(label: 'Purchased Price', value: snapshot.data?.purchasedPrice?.toString() ?? '-'),
]);
}
return const SizedBox();
})
],
],
).toShadowContainer(context, borderRadius: 20, padding: 12);
).toShadowContainer(context, borderRadius: 20, padding: 16);
}
}

Loading…
Cancel
Save