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,
appBar: DefaultAppBar(title: context.translation.createWorkOrder),
body: Consumer<ServiceRequestsProvider>(builder: (context, serviceRequestProvider, child) {
return SafeArea(
child: LoadingManager(
isLoading: _isLoading,
isFailedLoading: false,
stateCode: 200,
onRefresh: () async {},
child: Form(
key: _formKey,
child: Column(
children: [
SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
scanAssetButton(),
if (pendingAssetServiceRequest != null && pendingAssetServiceRequest!.details!.isNotEmpty) ...[
8.height,
Row(
children: [
const Icon(Icons.warning, color: Color(0xffEE404C), size: 14),
8.width,
Text(
"This asset already have ${pendingAssetServiceRequest!.details!.length} request pending",
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Color(0xff7D859A), decoration: TextDecoration.underline),
).expanded,
],
).onPress(() {
showPendingRequests();
}),
],
if (Provider.of<SettingProvider>(context, listen: false).showPriority) ...[
16.height,
highPriorityWidget(),
],
return LoadingManager(
isLoading: _isLoading,
isFailedLoading: false,
stateCode: 200,
onRefresh: () async {},
child: Form(
key: _formKey,
child: Column(
children: [
SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
scanAssetButton(),
if (pendingAssetServiceRequest != null && pendingAssetServiceRequest!.details!.isNotEmpty) ...[
8.height,
Row(
children: [
const Icon(Icons.warning, color: Color(0xffEE404C), size: 14),
8.width,
Text(
"This asset already have ${pendingAssetServiceRequest!.details!.length} request pending",
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Color(0xff7D859A), decoration: TextDecoration.underline),
).expanded,
],
).onPress(() {
showPendingRequests();
}),
],
if (Provider.of<SettingProvider>(context, listen: false).showPriority) ...[
16.height,
assetStatusWidget(context),
24.height,
AttachmentPicker(
label: context.translation.attachImage,
attachment: _deviceImages,
buttonColor: AppColor.black10,
onlyImages: false,
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
),
highPriorityWidget(),
],
).paddingAll(0).toShadowContainer(context),
16.height,
commentWidget(serviceRequest: _serviceRequest),
],
),
).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,
),
16.height,
assetStatusWidget(context),
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,
commentWidget(serviceRequest: _serviceRequest),
],
),
).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);
}
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 = [];
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));
}
_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) ...[
const Divider().defaultStyle(context),
Text(

@ -121,149 +121,147 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
),
body: Form(
key: _formKey,
child: SafeArea(
child: Column(
children: [
SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AssetPicker(
device: _pickedAsset,
showLoading: false,
borderColor: AppColor.black20,
backgroundColor: AppColor.white936,
onPick: (asset) async {
_pickedAsset = asset;
child: Column(
children: [
SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AssetPicker(
device: _pickedAsset,
showLoading: false,
borderColor: AppColor.black20,
backgroundColor: AppColor.white936,
onPick: (asset) async {
_pickedAsset = asset;
if (_pickedAsset?.site != null && _transferModel.transferType?.value == 1) {
await _deviceTransferProvider.getSiteData(siteId: int.tryParse(_pickedAsset!.site!.id.toString()));
_assetDestination.site = _deviceTransferProvider.internalAssetDestination?.site;
_assetDestination.building = null;
_assetDestination.floor = null;
_assetDestination.department = null;
} else if (_pickedAsset?.site != null && _transferModel.transferType?.value == 2) {
_assetDestination.site = null;
_assetDestination.building = null;
_assetDestination.floor = null;
_assetDestination.department = null;
}
if (_pickedAsset?.site != null && _transferModel.transferType?.value == 1) {
await _deviceTransferProvider.getSiteData(siteId: int.tryParse(_pickedAsset!.site!.id.toString()));
_assetDestination.site = _deviceTransferProvider.internalAssetDestination?.site;
_assetDestination.building = null;
_assetDestination.floor = null;
_assetDestination.department = null;
} else if (_pickedAsset?.site != null && _transferModel.transferType?.value == 2) {
_assetDestination.site = null;
_assetDestination.building = null;
_assetDestination.floor = 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(() {});
}),
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(() {});
},
).expanded,
8.width,
SingleItemDropDownMenu<Building, NullableLoadingProvider>(
context: context,
title: context.translation.building,
initialValue: _assetDestination.building,
showShadow: false,
showAsBottomSheet: true,
backgroundColor: AppColor.fieldBgColor(context),
enabled: _assetDestination.site?.buildings?.isNotEmpty ?? false,
staticData: _assetDestination.site?.buildings ?? [],
onSelect: (value) {
_assetDestination.building = value;
_assetDestination.floor = null;
_assetDestination.department = null;
setState(() {});
},
).expanded,
],
),
8.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SingleItemDropDownMenu<Floor, NullableLoadingProvider>(
context: context,
title: context.translation.floor,
showShadow: false,
showAsBottomSheet: true,
initialValue: _assetDestination.floor,
backgroundColor: AppColor.fieldBgColor(context),
enabled: _assetDestination.building?.floors?.isNotEmpty ?? false,
staticData: _assetDestination.building?.floors ?? [],
onSelect: (value) {
_assetDestination.floor = value;
_assetDestination.department = null;
setState(() {});
},
).expanded,
8.width,
SingleItemDropDownMenu<Department, NullableLoadingProvider>(
context: context,
title: context.translation.department,
showShadow: false,
showAsBottomSheet: true,
initialValue: _assetDestination.department,
backgroundColor: AppColor.fieldBgColor(context),
enabled: _assetDestination.floor?.departments?.isNotEmpty ?? false,
staticData: _assetDestination.floor?.departments ?? [],
onSelect: (value) {
_assetDestination.department = value;
_assetDestination.room = null;
setState(() {});
},
).expanded,
],
),
8.height,
AppTextFormField(
backgroundColor: AppColor.fieldBgColor(context),
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),
),
],
),
},
).expanded,
8.width,
SingleItemDropDownMenu<Building, NullableLoadingProvider>(
context: context,
title: context.translation.building,
initialValue: _assetDestination.building,
showShadow: false,
showAsBottomSheet: true,
backgroundColor: AppColor.fieldBgColor(context),
enabled: _assetDestination.site?.buildings?.isNotEmpty ?? false,
staticData: _assetDestination.site?.buildings ?? [],
onSelect: (value) {
_assetDestination.building = value;
_assetDestination.floor = null;
_assetDestination.department = null;
setState(() {});
},
).expanded,
],
),
8.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SingleItemDropDownMenu<Floor, NullableLoadingProvider>(
context: context,
title: context.translation.floor,
showShadow: false,
showAsBottomSheet: true,
initialValue: _assetDestination.floor,
backgroundColor: AppColor.fieldBgColor(context),
enabled: _assetDestination.building?.floors?.isNotEmpty ?? false,
staticData: _assetDestination.building?.floors ?? [],
onSelect: (value) {
_assetDestination.floor = value;
_assetDestination.department = null;
setState(() {});
},
).expanded,
8.width,
SingleItemDropDownMenu<Department, NullableLoadingProvider>(
context: context,
title: context.translation.department,
showShadow: false,
showAsBottomSheet: true,
initialValue: _assetDestination.department,
backgroundColor: AppColor.fieldBgColor(context),
enabled: _assetDestination.floor?.departments?.isNotEmpty ?? false,
staticData: _assetDestination.floor?.departments ?? [],
onSelect: (value) {
_assetDestination.department = value;
_assetDestination.room = null;
setState(() {});
},
).expanded,
],
),
8.height,
AppTextFormField(
backgroundColor: AppColor.fieldBgColor(context),
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/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/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
@ -169,36 +170,69 @@ class _SearchDevicePageState extends State<SearchDevicePage> {
},
).expanded,
if (widget.multiSelection && selectedAssets.isNotEmpty)
Row(
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: AppFilledButton(
label: "Clear",
buttonColor: AppColor.white60,
textColor: AppColor.black10,
loading: false,
onPressed: () async {
selectedAssets.clear();
setState(() {});
},
FooterActionButton.footerContainer(
context: context,
child: 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);
},
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),
],
)
),
// 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/widget_extensions.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/common_widgets/app_filled_button.dart';
@ -159,22 +160,24 @@ class _SelectionBottomSheetState<T extends Base> extends State<SelectionFullScre
},
title: Text(
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,
if (_selectedValue != null)
AppFilledButton(
label: context.translation.select,
maxWidth: true,
onPressed: () {
Navigator.pop(context);
widget.onSelect(_selectedValue);
},
).paddingAll(16),
if (_selectedValue != null) 16.height,
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.select,
maxWidth: true,
onPressed: () {
Navigator.pop(context);
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/int_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/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 '../../../models/device/asset_search.dart';
@ -69,8 +72,10 @@ class _AssetScanQrState extends State<AssetScanQr> {
Widget build(BuildContext context) {
_devicesProvider = Provider.of<AssetProvider>(context);
return Scaffold(
body: SafeArea(
child: Stack(
appBar: DefaultAppBar(title: widget.title),
body: Column(
children: [
Stack(
children: [
QRView(
key: qrKey,
@ -102,24 +107,35 @@ class _AssetScanQrState extends State<AssetScanQr> {
fit: BoxFit.fitHeight,
),
),
SizedBox(height: 60.toScreenHeight, child: CustomAppBar(title: widget.title)),
],
),
),
bottomSheet: 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,
),
).expanded,
FooterActionButton.footerContainer(
context: context,
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