|
|
|
|
@ -24,6 +24,8 @@ import 'package:test_sa/new_views/common_widgets/app_filled_button.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/images/files_list.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';
|
|
|
|
|
|
|
|
|
|
@ -94,17 +96,17 @@ class _ActivitiesListViewState extends State<ActivitiesListView> {
|
|
|
|
|
if (userProvider.user!.type == UsersTypes.engineer &&
|
|
|
|
|
(requestDetailProvider.currentWorkOrder?.data?.status?.value != 5 && requestDetailProvider.currentWorkOrder?.data?.status?.value != 3))
|
|
|
|
|
FooterActionButton.footerContainer(
|
|
|
|
|
context: context,
|
|
|
|
|
context: context,
|
|
|
|
|
child: AppFilledButton(
|
|
|
|
|
label: context.translation.createNewActivity,
|
|
|
|
|
maxWidth: true,
|
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
|
loading: requestDetailProvider.isLoading,
|
|
|
|
|
disableButton: disableNewActivity,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
ServiceRequestBottomSheet.activityTypeBottomSheet(context: context);
|
|
|
|
|
},
|
|
|
|
|
))
|
|
|
|
|
label: context.translation.createNewActivity,
|
|
|
|
|
maxWidth: true,
|
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
|
loading: requestDetailProvider.isLoading,
|
|
|
|
|
disableButton: disableNewActivity,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
ServiceRequestBottomSheet.activityTypeBottomSheet(context: context);
|
|
|
|
|
},
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
@ -127,11 +129,8 @@ class _ActivitiesListViewState extends State<ActivitiesListView> {
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: activity.activityStatus?.name,
|
|
|
|
|
textColor: AppColor.white10,
|
|
|
|
|
// textColor: AppColor.getHistoryLogStatusTextColorByName(activity.activityStatus!.name!),
|
|
|
|
|
// backgroundColor: AppColor.getHistoryLogStatusColorByName(activity.activityStatus!.name!),
|
|
|
|
|
backgroundColor: AppColor.primary10,
|
|
|
|
|
),
|
|
|
|
|
// "drag_icon".toSvgAsset(height: 12, width: 23, color: AppColor.neutral160),
|
|
|
|
|
if (showActionButtons)
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
@ -140,7 +139,7 @@ class _ActivitiesListViewState extends State<ActivitiesListView> {
|
|
|
|
|
"edit_icon".toSvgAsset(height: 24, width: 24, color: AppColor.icon2Color(context)).onPress(() {
|
|
|
|
|
editSparePartRequest(context: context, requestDetailProvider: requestDetailProvider, activity: activity);
|
|
|
|
|
}),
|
|
|
|
|
24.width,
|
|
|
|
|
12.width,
|
|
|
|
|
"delete_icon".toSvgAsset(height: 24, width: 24).onPress(() async {
|
|
|
|
|
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
|
|
|
|
|
int status = await requestDetailProvider.deleteActivitySparePart(id: activity.id!, workOrderId: requestDetailProvider.currentWorkOrder!.data!.requestId!);
|
|
|
|
|
@ -157,28 +156,18 @@ class _ActivitiesListViewState extends State<ActivitiesListView> {
|
|
|
|
|
),
|
|
|
|
|
6.height,
|
|
|
|
|
//activity type...
|
|
|
|
|
Text(
|
|
|
|
|
'${activity.activityType?.cleanupWhitespace.capitalizeFirstOfEach}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
3.height,
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.partName}: ${activity.activitySparePart?.partCatalogItem?.partName}',
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral120),
|
|
|
|
|
InfoHeaderWidget(activity.activityType?.cleanupWhitespace.capitalizeFirstOfEach ?? '-'),
|
|
|
|
|
InfoTextWidget(
|
|
|
|
|
label: context.translation.partName,
|
|
|
|
|
value: activity.activitySparePart?.partCatalogItem?.partName,
|
|
|
|
|
),
|
|
|
|
|
2.height,
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.partNo}: ${activity.activitySparePart?.partCatalogItem?.partNumber}',
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral120),
|
|
|
|
|
InfoTextWidget(
|
|
|
|
|
label: context.translation.partNo,
|
|
|
|
|
value: activity.activitySparePart?.partCatalogItem?.partNumber,
|
|
|
|
|
),
|
|
|
|
|
2.height,
|
|
|
|
|
if (activity.activitySparePart?.comment?.isNotEmpty ?? false) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
2.height,
|
|
|
|
|
Text(
|
|
|
|
|
activity.activitySparePart?.comment ?? "",
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
InfoTextLabelWidget(label: activity.activitySparePart?.comment ?? ''),
|
|
|
|
|
],
|
|
|
|
|
if (activity.activitySparePart?.acitiySparePartAttachments?.isNotEmpty ?? false) ...[
|
|
|
|
|
2.height,
|
|
|
|
|
@ -212,28 +201,22 @@ class _ActivitiesListViewState extends State<ActivitiesListView> {
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
//TODO will be here when fixed from backend..
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: activity.activityStatus?.name,
|
|
|
|
|
textColor: AppColor.white10,
|
|
|
|
|
// textColor: AppColor.getHistoryLogStatusTextColorByName(activity.activityStatus!.name!),
|
|
|
|
|
// backgroundColor: AppColor.getHistoryLogStatusColorByName(activity.activityStatus!.name!),
|
|
|
|
|
backgroundColor: AppColor.primary10,
|
|
|
|
|
),
|
|
|
|
|
5.width,
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: activity.activityMaintenance?.activityType,
|
|
|
|
|
// textColor: AppColor.white10,
|
|
|
|
|
textColor: AppColor.getActivityTypeTextColor(activity.activityMaintenance?.activityType ?? ''),
|
|
|
|
|
backgroundColor: AppColor.getActivityTypeBgColor(activity.activityMaintenance?.activityType ?? ''),
|
|
|
|
|
// backgroundColor: AppColor.primary10,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// "drag_icon".toSvgAsset(height: 12, width: 23, color: AppColor.neutral160),
|
|
|
|
|
if (showActionButtons)
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
@ -242,7 +225,7 @@ class _ActivitiesListViewState extends State<ActivitiesListView> {
|
|
|
|
|
"edit_icon".toSvgAsset(height: 24, width: 24, color: AppColor.icon2Color(context)).onPress(() {
|
|
|
|
|
editMaintenanceRequest(context: context, requestDetailProvider: requestDetailProvider, activity: activity);
|
|
|
|
|
}),
|
|
|
|
|
24.width,
|
|
|
|
|
12.width,
|
|
|
|
|
"delete_icon".toSvgAsset(height: 24, width: 24).onPress(() async {
|
|
|
|
|
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
|
|
|
|
|
int status = await requestDetailProvider.deleteActivityMaintenance(id: activity.id!, workOrderId: requestDetailProvider.currentWorkOrder!.data!.requestId!);
|
|
|
|
|
@ -258,37 +241,26 @@ class _ActivitiesListViewState extends State<ActivitiesListView> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
6.height,
|
|
|
|
|
//activity type...
|
|
|
|
|
Text(
|
|
|
|
|
'${activity.activityType?.cleanupWhitespace.capitalizeFirstOfEach}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
|
|
|
|
InfoHeaderWidget(activity.activityType?.cleanupWhitespace.capitalizeFirstOfEach ?? ''),
|
|
|
|
|
InfoTextWidget(
|
|
|
|
|
label: context.translation.workingHours,
|
|
|
|
|
value: totalWorkingHours > 0.0 ? CMRequestUtils.formatTimerDuration(totalWorkingHours.round()) : '-',
|
|
|
|
|
),
|
|
|
|
|
3.height,
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.workingHours}: ${totalWorkingHours > 0.0 ? CMRequestUtils.formatTimerDuration(totalWorkingHours.round()) : '-'}',
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
2.height,
|
|
|
|
|
if (activity.activityMaintenance?.assistantEmployees != null && activity.activityMaintenance!.assistantEmployees!.isNotEmpty) ...[
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.assistantEmployee}: ${activity.activityMaintenance?.assistantEmployees?.first.user?.userName}',
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral120),
|
|
|
|
|
InfoTextWidget(
|
|
|
|
|
label: context.translation.assistantEmployee,
|
|
|
|
|
value: activity.activityMaintenance?.assistantEmployees?.first.user?.userName,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
] else ...[
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.assignedEmployee}: ${activity.activityMaintenance?.assignedEmployee?.userName}',
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral120),
|
|
|
|
|
InfoTextWidget(
|
|
|
|
|
label: context.translation.assignedEmployee,
|
|
|
|
|
value: activity.activityMaintenance?.assignedEmployee?.userName,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
2.height,
|
|
|
|
|
if (activity.activityMaintenance?.technicalComment?.isNotEmpty ?? false) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
2.height,
|
|
|
|
|
Text(
|
|
|
|
|
activity.activityMaintenance?.technicalComment ?? "",
|
|
|
|
|
style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
InfoTextLabelWidget(label: activity.activityMaintenance?.technicalComment ?? ""),
|
|
|
|
|
],
|
|
|
|
|
//need to add all info here...
|
|
|
|
|
// if(requestDetailProvider.currentWorkOrder?.data?.status?.id==3498)...[
|
|
|
|
|
@ -338,7 +310,7 @@ class _ActivitiesListViewState extends State<ActivitiesListView> {
|
|
|
|
|
// lastSituation: activity.activityMaintenance?.lastSituation,
|
|
|
|
|
assignedEmployee: activity.activityMaintenance?.assignedEmployee != null ? WorkOrderAssignedEmployee.fromJson(activity.activityMaintenance!.assignedEmployee!.toJson()) : null,
|
|
|
|
|
technicalComment: activity.activityMaintenance?.technicalComment,
|
|
|
|
|
assistantEmployList:activity.activityMaintenance!.assistantEmployees??[] ,
|
|
|
|
|
assistantEmployList: activity.activityMaintenance!.assistantEmployees ?? [],
|
|
|
|
|
// assistantEmployees:
|
|
|
|
|
// activity.activityMaintenance?.assistantEmployees != null && activity.activityMaintenance!.assistantEmployees!.isNotEmpty ? [AssistantEmployees.fromJson(assistEmpData)] : [],
|
|
|
|
|
// modelAssistantEmployees:
|
|
|
|
|
|