|
|
|
|
@ -80,7 +80,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
|
|
|
|
|
_formKey.currentState!.save();
|
|
|
|
|
List<AssetTransferAttachment> attachement = [];
|
|
|
|
|
for (var item in attachments) {
|
|
|
|
|
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(AssetTransferAttachment(id: item.id, attachmentName: fileName));
|
|
|
|
|
}
|
|
|
|
|
_transferModel.attachments = attachement;
|
|
|
|
|
@ -135,19 +135,26 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
}),
|
|
|
|
|
21.height,
|
|
|
|
|
requestTypeWidget(context),
|
|
|
|
|
12.height,
|
|
|
|
|
"Destination".bodyText(context).custom(color:context.isDark?Colors.white: AppColor.white936),
|
|
|
|
|
"Destination".bodyText(context).custom(color: context.isDark ? Colors.white : AppColor.white936),
|
|
|
|
|
12.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
@ -156,6 +163,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
|
|
|
|
|
context: context,
|
|
|
|
|
title: context.translation.site,
|
|
|
|
|
initialValue: _assetDestination.site,
|
|
|
|
|
disableValue: isInternal ? null : _pickedAsset?.site,
|
|
|
|
|
showShadow: false,
|
|
|
|
|
loading: _deviceTransferProvider.isSiteLoading,
|
|
|
|
|
enabled: !isInternal,
|
|
|
|
|
@ -273,7 +281,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
context.translation.requestType.bodyText(context).custom(color:context.isDark?Colors.white: AppColor.white936),
|
|
|
|
|
context.translation.requestType.bodyText(context).custom(color: context.isDark ? Colors.white : AppColor.white936),
|
|
|
|
|
8.height,
|
|
|
|
|
Wrap(
|
|
|
|
|
runSpacing: 8,
|
|
|
|
|
@ -299,7 +307,17 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
|
|
|
|
|
onChanged: (state) {
|
|
|
|
|
_transferModel.transferType = element;
|
|
|
|
|
isInternal = !isInternal;
|
|
|
|
|
// _assetDestination = Asset();
|
|
|
|
|
if (isInternal) {
|
|
|
|
|
_assetDestination.site = _deviceTransferProvider.internalAssetDestination?.site;
|
|
|
|
|
_assetDestination.building = null;
|
|
|
|
|
_assetDestination.floor = null;
|
|
|
|
|
_assetDestination.department = null;
|
|
|
|
|
} else {
|
|
|
|
|
_assetDestination.site = null;
|
|
|
|
|
_assetDestination.building = null;
|
|
|
|
|
_assetDestination.floor = null;
|
|
|
|
|
_assetDestination.department = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
// });
|
|
|
|
|
@ -310,7 +328,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).toShimmer(isShow: snapshot.loading,context: context),
|
|
|
|
|
).toShimmer(isShow: snapshot.loading, context: context),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|