|
|
|
|
@ -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),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|