From 7d25f2be01863b8b482650b3fd7a8ce58ee0b4f5 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Sun, 24 May 2026 14:23:52 +0300 Subject: [PATCH] UAT Improvements. --- .../widgets/request_category_fragment.dart | 9 ++--- lib/models/site_contact_info_model.dart | 5 ++- .../export_module/pages/export_form_view.dart | 12 +++++-- .../provider/export_provider.dart | 25 +++++++++----- lib/new_views/app_style/app_color.dart | 1 + .../land_page/contact_us_bottom_sheet.dart | 7 ++-- .../my_request/all_requests_search_page.dart | 33 +++++++++---------- 7 files changed, 56 insertions(+), 36 deletions(-) diff --git a/lib/dashboard_latest/widgets/request_category_fragment.dart b/lib/dashboard_latest/widgets/request_category_fragment.dart index 18c8d313..08adc55c 100644 --- a/lib/dashboard_latest/widgets/request_category_fragment.dart +++ b/lib/dashboard_latest/widgets/request_category_fragment.dart @@ -130,10 +130,11 @@ class _RequestCategoryFragmentState extends State with spacing: 16, children: [ Text(context.translation.allWorkOrder, style: AppTextStyles.heading4.copyWith(color: AppColor.headingTextColor(context))).expanded, - if (!isFMSEngineer) - 'search'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() { - Navigator.of(context).pushNamed('/cleaner_search'); - }), + // todo commenting this code, for FM + // if (!isFMSEngineer) + // 'search'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() { + // Navigator.of(context).pushNamed('/cleaner_search'); + // }), Transform.flip( flipY: isAscending, child: 'dashboard/sort_descending'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() { diff --git a/lib/models/site_contact_info_model.dart b/lib/models/site_contact_info_model.dart index 82693a8d..d59060cc 100644 --- a/lib/models/site_contact_info_model.dart +++ b/lib/models/site_contact_info_model.dart @@ -4,8 +4,9 @@ class SiteContactInfoModel { int? siteId; String? siteName; String? phoneNumber; + String? extensionNumber; - SiteContactInfoModel({this.id, this.assetGroupId, this.siteId, this.siteName, this.phoneNumber}); + SiteContactInfoModel({this.id, this.assetGroupId, this.siteId, this.siteName, this.phoneNumber, this.extensionNumber}); SiteContactInfoModel.fromJson(Map json) { id = json['id']; @@ -13,6 +14,7 @@ class SiteContactInfoModel { siteId = json['siteId']; siteName = json['siteName']; phoneNumber = json['phoneNumber']; + extensionNumber = json['extensionNumber']; } Map toJson() { @@ -22,6 +24,7 @@ class SiteContactInfoModel { data['siteId'] = this.siteId; data['siteName'] = this.siteName; data['phoneNumber'] = this.phoneNumber; + data['extensionNumber'] = this.extensionNumber; return data; } } diff --git a/lib/modules/export_module/pages/export_form_view.dart b/lib/modules/export_module/pages/export_form_view.dart index 6075772b..ad574cfd 100644 --- a/lib/modules/export_module/pages/export_form_view.dart +++ b/lib/modules/export_module/pages/export_form_view.dart @@ -47,6 +47,13 @@ class _ExportFormViewState extends State> { List selectedColumns = []; Lookup? selectedFormat; + @override + void initState() { + // TODO: implement initState + super.initState(); + Provider.of(context, listen: false).reset(); + } + void _updateSelectedColumns(List? value) { if (value != null && mounted) { setState(() { @@ -135,7 +142,9 @@ class _ExportFormViewState extends State> { final filePath = await exportProvider.exportData(exportRequest, widget.moduleType, context); if (!mounted) return; - if (filePath != null && filePath.isNotEmpty) { + if (filePath != null && filePath.isEmpty) { + // do nothing, as toast handled in method + } else if (filePath != null && filePath.isNotEmpty) { await FileSuccessDialog.show( context: context, filePath: filePath, @@ -167,7 +176,6 @@ class _ExportFormViewState extends State> { ); } - //check if we need we can show this as well @waseem String _getAppSuggestion(String format) { diff --git a/lib/modules/export_module/provider/export_provider.dart b/lib/modules/export_module/provider/export_provider.dart index efaf9154..f80c390e 100644 --- a/lib/modules/export_module/provider/export_provider.dart +++ b/lib/modules/export_module/provider/export_provider.dart @@ -3,10 +3,13 @@ import 'dart:developer'; import 'dart:io'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:path_provider/path_provider.dart'; import 'package:sn_progress_dialog/sn_progress_dialog.dart'; import 'package:test_sa/controllers/api_routes/api_manager.dart'; import 'package:test_sa/controllers/api_routes/urls.dart'; +import 'package:test_sa/extensions/string_extensions.dart'; +import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/modules/export_module/models/export_form_model.dart'; import 'package:test_sa/modules/export_module/models/export_module_type.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; @@ -34,7 +37,7 @@ class ExportApiProvider extends ChangeNotifier { // Use isDarkNotListen to safely access provider without listening final backgroundColor = context.isDarkNotListen ? AppColor.containerDark : Colors.white; final textColor = context.isDarkNotListen ? AppColor.white10 : AppColor.white936; - + bool isPdCancel = false; ProgressDialog pd = ProgressDialog(context: context); pd.show( max: 100, @@ -48,6 +51,14 @@ class ExportApiProvider extends ChangeNotifier { elevation: 4, msgFontSize: 14, backgroundColor: backgroundColor, + cancel: Cancel( + cancelClicked: () { + isPdCancel = true; + 'Export Canceled'.showToast; + pd.close(); + }, + cancelImageColor: AppColor.icon2ColorNotListen(context), + ), ); IOSink? sink; @@ -100,16 +111,11 @@ class ExportApiProvider extends ChangeNotifier { lastProgress = progress; final downloadedMB = (received / 1024 / 1024).toStringAsFixed(2); final totalMB = (contentLength / 1024 / 1024).toStringAsFixed(2); - pd.update( - value: progress, - msg: 'Exporting: $downloadedMB MB / $totalMB MB', - ); + pd.update(value: progress, msg: 'Exporting: $downloadedMB MB / $totalMB MB'); } } else { final downloadedMB = (received / 1024 / 1024).toStringAsFixed(2); - pd.update( - msg: 'Exporting: $downloadedMB MB', - ); + pd.update(msg: 'Exporting: $downloadedMB MB'); } } await sink.close(); @@ -123,6 +129,9 @@ class ExportApiProvider extends ChangeNotifier { } pd.close(); final totalTime = DateTime.now().difference(startTime).inMilliseconds; + if (isPdCancel) { + return ""; + } return filePath; } else { if (context.mounted) { diff --git a/lib/new_views/app_style/app_color.dart b/lib/new_views/app_style/app_color.dart index c20fc05e..97a7dfcd 100644 --- a/lib/new_views/app_style/app_color.dart +++ b/lib/new_views/app_style/app_color.dart @@ -182,6 +182,7 @@ class AppColor { static Color iconColor(BuildContext context) => context.isDark ? neutral30 : neutral50; static Color icon2Color(BuildContext context) => context.isDark ? white10 : neutral50; + static Color icon2ColorNotListen(BuildContext context) => context.isDarkNotListen ? white10 : neutral50; static Color textStyleColor(BuildContext context) => context.isDark ? white10 : neutral50; diff --git a/lib/new_views/pages/land_page/contact_us_bottom_sheet.dart b/lib/new_views/pages/land_page/contact_us_bottom_sheet.dart index 3c537410..ecaac532 100644 --- a/lib/new_views/pages/land_page/contact_us_bottom_sheet.dart +++ b/lib/new_views/pages/land_page/contact_us_bottom_sheet.dart @@ -65,10 +65,9 @@ class ContactUsBottomSheet extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, spacing: 4, children: [ - InfoHeaderWidget( - sites[index].siteName ?? "", - ), - InfoTextWidget(label: sites[index].phoneNumber ?? "", isMsg: true, showEmptyValue: true), + InfoHeaderWidget(sites[index].siteName ?? ""), + InfoTextWidget(label: "Phone Number", value: sites[index].phoneNumber ?? ""), + InfoTextWidget(label: "Extension", value: sites[index].extensionNumber ?? "-"), ], ).expanded, IconButton( diff --git a/lib/new_views/pages/land_page/my_request/all_requests_search_page.dart b/lib/new_views/pages/land_page/my_request/all_requests_search_page.dart index 15a59401..1dd6da60 100644 --- a/lib/new_views/pages/land_page/my_request/all_requests_search_page.dart +++ b/lib/new_views/pages/land_page/my_request/all_requests_search_page.dart @@ -90,23 +90,22 @@ class _AllRequestsSearchPageState extends State { title: context.translation.search, actions: [ if (_showResetButton()) - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - context.translation.reset, - style: AppTextStyles.bodyText2.copyWith(color: const Color(0xFF4A8DB7)), - ).paddingAll(8).onPress(() { - setState(() { - // search!.resetSearchValues(); - search?.resetSearchValuesAndController(except: null); - search!.startDate = null; - search!.endDate = null; - selectedSortOption = SortOrder.descending; - }); - }), - ], - ) + TextButton( + onPressed: () { + setState(() { + // search!.resetSearchValues(); + search?.resetSearchValuesAndController(except: null); + search!.startDate = null; + search!.endDate = null; + selectedSortOption = SortOrder.descending; + }); + }, + style: TextButton.styleFrom(padding: EdgeInsets.zero, tapTargetSize: MaterialTapTargetSize.shrinkWrap), + child: Text( + 'Clear', + style: AppTextStyles.bodyText2.copyWith(color: AppColor.red30), + ), + ), ], ), body: Form(