task contact info in detail view, & improvements

design_3.0_TM_Module_snagsFix
Sikander Saleem 2 months ago
parent 9a332e86e2
commit b7aefbe7f3

@ -116,75 +116,73 @@ class _CreateNewRequestState extends State<CreateNewRequest> with TickerProvider
key: _scaffoldKey, key: _scaffoldKey,
appBar: DefaultAppBar(title: context.translation.createWorkOrder), appBar: DefaultAppBar(title: context.translation.createWorkOrder),
body: Consumer<ServiceRequestsProvider>(builder: (context, serviceRequestProvider, child) { body: Consumer<ServiceRequestsProvider>(builder: (context, serviceRequestProvider, child) {
return SafeArea( return LoadingManager(
child: LoadingManager( isLoading: _isLoading,
isLoading: _isLoading, isFailedLoading: false,
isFailedLoading: false, stateCode: 200,
stateCode: 200, onRefresh: () async {},
onRefresh: () async {}, child: Form(
child: Form( key: _formKey,
key: _formKey, child: Column(
child: Column( children: [
children: [ SingleChildScrollView(
SingleChildScrollView( padding: const EdgeInsets.all(16),
padding: const EdgeInsets.all(16), child: Column(
child: Column( children: [
children: [ Column(
Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ scanAssetButton(),
scanAssetButton(), if (pendingAssetServiceRequest != null && pendingAssetServiceRequest!.details!.isNotEmpty) ...[
if (pendingAssetServiceRequest != null && pendingAssetServiceRequest!.details!.isNotEmpty) ...[ 8.height,
8.height, Row(
Row( children: [
children: [ const Icon(Icons.warning, color: Color(0xffEE404C), size: 14),
const Icon(Icons.warning, color: Color(0xffEE404C), size: 14), 8.width,
8.width, Text(
Text( "This asset already have ${pendingAssetServiceRequest!.details!.length} request pending",
"This asset already have ${pendingAssetServiceRequest!.details!.length} request pending", style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Color(0xff7D859A), decoration: TextDecoration.underline),
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Color(0xff7D859A), decoration: TextDecoration.underline), ).expanded,
).expanded, ],
], ).onPress(() {
).onPress(() { showPendingRequests();
showPendingRequests(); }),
}), ],
], if (Provider.of<SettingProvider>(context, listen: false).showPriority) ...[
if (Provider.of<SettingProvider>(context, listen: false).showPriority) ...[
16.height,
highPriorityWidget(),
],
16.height, 16.height,
assetStatusWidget(context), highPriorityWidget(),
24.height,
AttachmentPicker(
label: context.translation.attachImage,
attachment: _deviceImages,
buttonColor: AppColor.black10,
onlyImages: false,
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
),
], ],
).paddingAll(0).toShadowContainer(context), 16.height,
16.height, assetStatusWidget(context),
commentWidget(serviceRequest: _serviceRequest), 24.height,
], AttachmentPicker(
), label: context.translation.attachImage,
).expanded, attachment: _deviceImages,
FooterActionButton.footerContainer( buttonColor: AppColor.black10,
context: context, onlyImages: false,
child: AppFilledButton( buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
// label: context.translation.submitRequest, ),
buttonColor: AppColor.primary10, ],
label: ).paddingAll(0).toShadowContainer(context),
// (pendingAssetServiceRequest != null && (pendingAssetServiceRequest!.details?.isNotEmpty ?? false)) 16.height,
// ? context.translation.duplicateRequest : // @FM said show create work order button text to create request not duplicate request commentWidget(serviceRequest: _serviceRequest),
context.translation.createWorkOrder, ],
onPressed: checkPendingRequest ? null : _submit, ),
// buttonColor: AppColor.primary10, ).expanded,
), FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(
// label: context.translation.submitRequest,
buttonColor: AppColor.primary10,
label:
// (pendingAssetServiceRequest != null && (pendingAssetServiceRequest!.details?.isNotEmpty ?? false))
// ? context.translation.duplicateRequest : // @FM said show create work order button text to create request not duplicate request
context.translation.createWorkOrder,
onPressed: checkPendingRequest ? null : _submit,
// buttonColor: AppColor.primary10,
), ),
], ),
), ],
), ),
), ),
); );
@ -238,7 +236,7 @@ class _CreateNewRequestState extends State<CreateNewRequest> with TickerProvider
], ],
) )
], ],
).toShimmer(isShow: snapshot.loading,context: context), ).toShimmer(isShow: snapshot.loading, context: context),
], ],
); );
}); });
@ -280,7 +278,7 @@ class _CreateNewRequestState extends State<CreateNewRequest> with TickerProvider
_serviceRequest.priority = snapshot.items.firstWhere((element) => element.value == 0, orElse: null); _serviceRequest.priority = snapshot.items.firstWhere((element) => element.value == 0, orElse: null);
} }
setState(() {}); setState(() {});
}).toShimmer(isShow: snapshot.loading,context: context); }).toShimmer(isShow: snapshot.loading, context: context);
}), }),
], ],
); );
@ -354,7 +352,7 @@ class _CreateNewRequestState extends State<CreateNewRequest> with TickerProvider
} }
List<WorkOrderAttachments> attachement = []; List<WorkOrderAttachments> attachement = [];
for (var item in _deviceImages) { for (var item in _deviceImages) {
String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??''; String fileName = ServiceRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? '';
attachement.add(WorkOrderAttachments(id: 0, name: fileName)); attachement.add(WorkOrderAttachments(id: 0, name: fileName));
} }
_requestDetailProvider.workOrderHelperModel = WorkOrderHelperModel( _requestDetailProvider.workOrderHelperModel = WorkOrderHelperModel(

@ -122,7 +122,7 @@ class _TaskRequestDetailsViewState extends State<TaskRequestDetailsView> {
], ],
), ),
], ],
// if (taskProvider.taskRequestModel!.taskJobContactPersons!.isNotEmpty) contactInfoCard(context, taskProvider.taskRequestModel), if (taskProvider.taskRequestModel!.taskJobContactPersons!.isNotEmpty) contactInfoCard(context, taskProvider.taskRequestModel),
if (taskProvider.taskRequestModel?.callComment != null) ...[ if (taskProvider.taskRequestModel?.callComment != null) ...[
const Divider().defaultStyle(context), const Divider().defaultStyle(context),
Text( Text(

@ -121,149 +121,147 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
), ),
body: Form( body: Form(
key: _formKey, key: _formKey,
child: SafeArea( child: Column(
child: Column( children: [
children: [ SingleChildScrollView(
SingleChildScrollView( child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ AssetPicker(
AssetPicker( device: _pickedAsset,
device: _pickedAsset, showLoading: false,
showLoading: false, borderColor: AppColor.black20,
borderColor: AppColor.black20, backgroundColor: AppColor.white936,
backgroundColor: AppColor.white936, onPick: (asset) async {
onPick: (asset) async { _pickedAsset = asset;
_pickedAsset = asset;
if (_pickedAsset?.site != null && _transferModel.transferType?.value == 1) { if (_pickedAsset?.site != null && _transferModel.transferType?.value == 1) {
await _deviceTransferProvider.getSiteData(siteId: int.tryParse(_pickedAsset!.site!.id.toString())); await _deviceTransferProvider.getSiteData(siteId: int.tryParse(_pickedAsset!.site!.id.toString()));
_assetDestination.site = _deviceTransferProvider.internalAssetDestination?.site; _assetDestination.site = _deviceTransferProvider.internalAssetDestination?.site;
_assetDestination.building = null; _assetDestination.building = null;
_assetDestination.floor = null; _assetDestination.floor = null;
_assetDestination.department = null; _assetDestination.department = null;
} else if (_pickedAsset?.site != null && _transferModel.transferType?.value == 2) { } else if (_pickedAsset?.site != null && _transferModel.transferType?.value == 2) {
_assetDestination.site = null; _assetDestination.site = null;
_assetDestination.building = null; _assetDestination.building = null;
_assetDestination.floor = null; _assetDestination.floor = null;
_assetDestination.department = null; _assetDestination.department = null;
} }
setState(() {});
}),
21.height,
requestTypeWidget(context),
12.height,
"Destination".bodyText(context).custom(color: context.isDark ? Colors.white : AppColor.white936),
12.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SingleItemDropDownMenu<Site, SiteProvider>(
context: context,
title: context.translation.site,
initialValue: _assetDestination.site,
disableValue: isInternal ? null : _pickedAsset?.site,
showShadow: false,
loading: _deviceTransferProvider.isSiteLoading,
enabled: !isInternal,
backgroundColor: AppColor.fieldBgColor(context),
showAsBottomSheet: true,
onSelect: (value) {
_assetDestination.site = value;
_assetDestination.building = null;
_assetDestination.floor = null;
_assetDestination.department = null;
setState(() {}); setState(() {});
}), },
21.height, ).expanded,
requestTypeWidget(context), 8.width,
12.height, SingleItemDropDownMenu<Building, NullableLoadingProvider>(
"Destination".bodyText(context).custom(color: context.isDark ? Colors.white : AppColor.white936), context: context,
12.height, title: context.translation.building,
Row( initialValue: _assetDestination.building,
mainAxisAlignment: MainAxisAlignment.spaceBetween, showShadow: false,
children: [ showAsBottomSheet: true,
SingleItemDropDownMenu<Site, SiteProvider>( backgroundColor: AppColor.fieldBgColor(context),
context: context, enabled: _assetDestination.site?.buildings?.isNotEmpty ?? false,
title: context.translation.site, staticData: _assetDestination.site?.buildings ?? [],
initialValue: _assetDestination.site, onSelect: (value) {
disableValue: isInternal ? null : _pickedAsset?.site, _assetDestination.building = value;
showShadow: false, _assetDestination.floor = null;
loading: _deviceTransferProvider.isSiteLoading, _assetDestination.department = null;
enabled: !isInternal, setState(() {});
backgroundColor: AppColor.fieldBgColor(context), },
showAsBottomSheet: true, ).expanded,
onSelect: (value) { ],
_assetDestination.site = value; ),
_assetDestination.building = null; 8.height,
_assetDestination.floor = null; Row(
_assetDestination.department = null; mainAxisAlignment: MainAxisAlignment.spaceBetween,
setState(() {}); children: [
}, SingleItemDropDownMenu<Floor, NullableLoadingProvider>(
).expanded, context: context,
8.width, title: context.translation.floor,
SingleItemDropDownMenu<Building, NullableLoadingProvider>( showShadow: false,
context: context, showAsBottomSheet: true,
title: context.translation.building, initialValue: _assetDestination.floor,
initialValue: _assetDestination.building, backgroundColor: AppColor.fieldBgColor(context),
showShadow: false, enabled: _assetDestination.building?.floors?.isNotEmpty ?? false,
showAsBottomSheet: true, staticData: _assetDestination.building?.floors ?? [],
backgroundColor: AppColor.fieldBgColor(context), onSelect: (value) {
enabled: _assetDestination.site?.buildings?.isNotEmpty ?? false, _assetDestination.floor = value;
staticData: _assetDestination.site?.buildings ?? [], _assetDestination.department = null;
onSelect: (value) { setState(() {});
_assetDestination.building = value; },
_assetDestination.floor = null; ).expanded,
_assetDestination.department = null; 8.width,
setState(() {}); SingleItemDropDownMenu<Department, NullableLoadingProvider>(
}, context: context,
).expanded, title: context.translation.department,
], showShadow: false,
), showAsBottomSheet: true,
8.height, initialValue: _assetDestination.department,
Row( backgroundColor: AppColor.fieldBgColor(context),
mainAxisAlignment: MainAxisAlignment.spaceBetween, enabled: _assetDestination.floor?.departments?.isNotEmpty ?? false,
children: [ staticData: _assetDestination.floor?.departments ?? [],
SingleItemDropDownMenu<Floor, NullableLoadingProvider>( onSelect: (value) {
context: context, _assetDestination.department = value;
title: context.translation.floor, _assetDestination.room = null;
showShadow: false, setState(() {});
showAsBottomSheet: true, },
initialValue: _assetDestination.floor, ).expanded,
backgroundColor: AppColor.fieldBgColor(context), ],
enabled: _assetDestination.building?.floors?.isNotEmpty ?? false, ),
staticData: _assetDestination.building?.floors ?? [], 8.height,
onSelect: (value) { AppTextFormField(
_assetDestination.floor = value; backgroundColor: AppColor.fieldBgColor(context),
_assetDestination.department = null; labelText: context.translation.callComments,
setState(() {}); labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
}, alignLabelWithHint: true,
).expanded, textInputType: TextInputType.multiline,
8.width, showShadow: false,
SingleItemDropDownMenu<Department, NullableLoadingProvider>( onSaved: (text) {
context: context, _transferModel.comment = text;
title: context.translation.department, },
showShadow: false, ),
showAsBottomSheet: true, 8.height,
initialValue: _assetDestination.department, 23.height,
backgroundColor: AppColor.fieldBgColor(context), AttachmentPicker(
enabled: _assetDestination.floor?.departments?.isNotEmpty ?? false, label: context.translation.attachImage,
staticData: _assetDestination.floor?.departments ?? [], attachment: attachments,
onSelect: (value) { buttonColor: AppColor.black10,
_assetDestination.department = value; onlyImages: false,
_assetDestination.room = null; buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
setState(() {}); ),
}, // 100.height,
).expanded, ],
], ).toShadowContainer(context).paddingOnly(top: 20, start: 16, end: 16),
), ).expanded,
8.height, FooterActionButton.footerContainer(
AppTextFormField( context: context,
backgroundColor: AppColor.fieldBgColor(context), child: AppFilledButton(buttonColor: AppColor.primary10, label: context.translation.submitRequest, maxWidth: true, onPressed: _onSubmit),
labelText: context.translation.callComments, ),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), ],
alignLabelWithHint: true,
textInputType: TextInputType.multiline,
showShadow: false,
onSaved: (text) {
_transferModel.comment = text;
},
),
8.height,
23.height,
AttachmentPicker(
label: context.translation.attachImage,
attachment: attachments,
buttonColor: AppColor.black10,
onlyImages: false,
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
),
// 100.height,
],
).toShadowContainer(context).paddingOnly(top: 20, start: 16, end: 16),
).expanded,
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(buttonColor: AppColor.primary10, label: context.translation.submitRequest, maxWidth: true, onPressed: _onSubmit),
),
],
),
), ),
), ),
); );

@ -5,6 +5,7 @@ import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_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/new_views/common_widgets/app_filled_button.dart'; 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/app_text_form_field.dart';
@ -169,36 +170,69 @@ class _SearchDevicePageState extends State<SearchDevicePage> {
}, },
).expanded, ).expanded,
if (widget.multiSelection && selectedAssets.isNotEmpty) if (widget.multiSelection && selectedAssets.isNotEmpty)
Row( FooterActionButton.footerContainer(
mainAxisSize: MainAxisSize.min, context: context,
children: [ child: Row(
Expanded( mainAxisSize: MainAxisSize.min,
child: AppFilledButton( children: [
label: "Clear", Expanded(
buttonColor: AppColor.white60, child: AppFilledButton(
textColor: AppColor.black10, label: "Clear",
loading: false, buttonColor: AppColor.white60,
onPressed: () async { textColor: AppColor.black10,
selectedAssets.clear(); loading: false,
setState(() {}); onPressed: () async {
}, selectedAssets.clear();
setState(() {});
},
),
), ),
), 12.width,
12.width, Expanded(
Expanded( child: AppFilledButton(
child: AppFilledButton( label: context.translation.select,
label: context.translation.select, buttonColor: AppColor.primary10,
buttonColor: AppColor.primary10, loading: false,
loading: false, onPressed: () async {
onPressed: () async { Navigator.of(context).pop();
Navigator.of(context).pop(); List<Asset> assets = _searchableList.where((asset) => selectedAssets.contains(asset.id)).toList();
List<Asset> assets = _searchableList.where((asset) => selectedAssets.contains(asset.id)).toList(); Navigator.of(context).pop(assets);
Navigator.of(context).pop(assets); },
}, ),
), ),
), ],
], )
).toShadowContainer(context), ),
// Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Expanded(
// child: AppFilledButton(
// label: "Clear",
// buttonColor: AppColor.white60,
// textColor: AppColor.black10,
// loading: false,
// onPressed: () async {
// selectedAssets.clear();
// setState(() {});
// },
// ),
// ),
// 12.width,
// Expanded(
// child: AppFilledButton(
// label: context.translation.select,
// buttonColor: AppColor.primary10,
// loading: false,
// onPressed: () async {
// Navigator.of(context).pop();
// List<Asset> assets = _searchableList.where((asset) => selectedAssets.contains(asset.id)).toList();
// Navigator.of(context).pop(assets);
// },
// ),
// ),
// ],
// ).toShadowContainer(context),
], ],
), ),
), ),

@ -4,6 +4,7 @@ import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/base.dart'; import 'package:test_sa/models/base.dart';
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
import 'package:test_sa/new_views/app_style/app_color.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/app_filled_button.dart';
@ -159,22 +160,24 @@ class _SelectionBottomSheetState<T extends Base> extends State<SelectionFullScre
}, },
title: Text( title: Text(
widget.builderString(filteredList![index]).cleanupWhitespace.capitalizeFirstOfEach ?? "", widget.builderString(filteredList![index]).cleanupWhitespace.capitalizeFirstOfEach ?? "",
style: Theme.of(context).textTheme.bodyLarge?.copyWith(color: isDisabledItem ? AppColor.neutral20:null), style: Theme.of(context).textTheme.bodyLarge?.copyWith(color: isDisabledItem ? AppColor.neutral20 : null),
), ),
), ),
); );
}), }),
), ),
8.height, 8.height,
if (_selectedValue != null) if (_selectedValue != null) 16.height,
AppFilledButton( FooterActionButton.footerContainer(
label: context.translation.select, context: context,
maxWidth: true, child: AppFilledButton(
onPressed: () { label: context.translation.select,
Navigator.pop(context); maxWidth: true,
widget.onSelect(_selectedValue); onPressed: () {
}, Navigator.pop(context);
).paddingAll(16), widget.onSelect(_selectedValue);
},
)),
], ],
), ),
); );

@ -6,7 +6,10 @@ import 'package:qr_code_scanner/qr_code_scanner.dart';
import 'package:test_sa/extensions/context_extension.dart'; import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/device/asset.dart'; import 'package:test_sa/models/device/asset.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 '../../../controllers/providers/api/devices_provider.dart'; import '../../../controllers/providers/api/devices_provider.dart';
import '../../../models/device/asset_search.dart'; import '../../../models/device/asset_search.dart';
@ -69,8 +72,10 @@ class _AssetScanQrState extends State<AssetScanQr> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
_devicesProvider = Provider.of<AssetProvider>(context); _devicesProvider = Provider.of<AssetProvider>(context);
return Scaffold( return Scaffold(
body: SafeArea( appBar: DefaultAppBar(title: widget.title),
child: Stack( body: Column(
children: [
Stack(
children: [ children: [
QRView( QRView(
key: qrKey, key: qrKey,
@ -102,24 +107,35 @@ class _AssetScanQrState extends State<AssetScanQr> {
fit: BoxFit.fitHeight, fit: BoxFit.fitHeight,
), ),
), ),
SizedBox(height: 60.toScreenHeight, child: CustomAppBar(title: widget.title)),
], ],
), ).expanded,
), FooterActionButton.footerContainer(
bottomSheet: Container( context: context,
height: 82.toScreenHeight, child: AppFilledButton(
color: Colors.white, label: context.translation.pickManually,
width: MediaQuery.of(context).size.width, onPressed: _pickManually,
child: Center(
child: SizedBox(
height: 50.toScreenHeight,
width: 358.toScreenWidth,
child: AppFilledButton(
label: context.translation.pickManually,
onPressed: _pickManually,
),
), ),
), ),
)); ],
),
// bottomSheet:
// 16.height,
// Container(
// height: 82.toScreenHeight,
// color: Colors.white,
// width: MediaQuery.of(context).size.width,
// child: Center(
// child: SizedBox(
// height: 50.toScreenHeight,
// width: 358.toScreenWidth,
// child: AppFilledButton(
// label: context.translation.pickManually,
// onPressed: _pickManually,
// ),
// ),
// ),
// )
);
} }
} }

Loading…
Cancel
Save