|
|
|
@ -3,23 +3,25 @@ import 'package:provider/provider.dart';
|
|
|
|
import 'package:test_sa/controllers/providers/api/asset_transfer_provider.dart';
|
|
|
|
import 'package:test_sa/controllers/providers/api/asset_transfer_provider.dart';
|
|
|
|
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
|
|
|
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
|
|
|
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
|
|
|
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
|
|
|
|
|
|
|
import 'package:test_sa/controllers/validator/validator.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/widget_extensions.dart';
|
|
|
|
import 'package:test_sa/models/device/asset_transfer.dart';
|
|
|
|
import 'package:test_sa/models/device/asset_transfer.dart';
|
|
|
|
import 'package:test_sa/models/subtitle.dart';
|
|
|
|
import 'package:test_sa/models/device/device.dart';
|
|
|
|
import 'package:test_sa/views/app_style/sizing.dart';
|
|
|
|
import 'package:test_sa/models/new_models/department.dart';
|
|
|
|
import 'package:test_sa/views/widgets/buttons/app_button.dart';
|
|
|
|
import 'package:test_sa/models/new_models/floor.dart';
|
|
|
|
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
|
|
|
|
import 'package:test_sa/views/widgets/titles/app_sub_title.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import '../../../../controllers/localization/localization.dart';
|
|
|
|
import '../../../models/new_models/building.dart';
|
|
|
|
import '../../../controllers/validator/validator.dart';
|
|
|
|
import '../../../models/new_models/site.dart';
|
|
|
|
import '../../app_style/colors.dart';
|
|
|
|
import '../../../new_views/common_widgets/app_filled_button.dart';
|
|
|
|
import '../../widgets/app_text_form_field.dart';
|
|
|
|
import '../../../new_views/common_widgets/default_app_bar.dart';
|
|
|
|
import '../../widgets/gas_refill/building_type_menu.dart';
|
|
|
|
import '../../../new_views/common_widgets/single_item_drop_down_menu.dart';
|
|
|
|
import '../../widgets/gas_refill/department_type_menu.dart';
|
|
|
|
import '../../../providers/gas_request_providers/site_provider.dart';
|
|
|
|
import '../../widgets/gas_refill/floor_type_menu.dart';
|
|
|
|
import '../../../providers/loading_list_notifier.dart';
|
|
|
|
import '../../widgets/hospitals/hospital_auto_complete_field_new.dart';
|
|
|
|
import '../../widgets/equipment/pick_asset.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class RequestDeviceTransfer extends StatefulWidget {
|
|
|
|
class RequestDeviceTransfer extends StatefulWidget {
|
|
|
|
static const String id = "/request-device-transfer";
|
|
|
|
static const String id = "/request-device-transfer";
|
|
|
|
@ -31,287 +33,148 @@ class RequestDeviceTransfer extends StatefulWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _RequestDeviceTransferState extends State<RequestDeviceTransfer> {
|
|
|
|
class _RequestDeviceTransferState extends State<RequestDeviceTransfer> {
|
|
|
|
bool _isLoading = false;
|
|
|
|
|
|
|
|
bool _validate = false;
|
|
|
|
|
|
|
|
UserProvider _userProvider;
|
|
|
|
UserProvider _userProvider;
|
|
|
|
SettingProvider _settingProvider;
|
|
|
|
SettingProvider _settingProvider;
|
|
|
|
AssetTransferProvider _deviceTransferProvider;
|
|
|
|
AssetTransferProvider _deviceTransferProvider;
|
|
|
|
final TextEditingController _requestedQuantityController = TextEditingController();
|
|
|
|
final TextEditingController _requestedQuantityController = TextEditingController();
|
|
|
|
final AssetTransfer _formModel = AssetTransfer(/*receiver: DeviceTransferInfo(), sender: DeviceTransferInfo()*/);
|
|
|
|
final AssetTransfer _transferModel = AssetTransfer();
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
|
|
|
|
final TextEditingController _receiverNameController = TextEditingController(), _commentsController = TextEditingController();
|
|
|
|
|
|
|
|
final Device _assetDestination = Device();
|
|
|
|
|
|
|
|
Device _pickedAsset;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void setState(VoidCallback fn) {
|
|
|
|
void setState(VoidCallback fn) {
|
|
|
|
if (mounted) super.setState(() {});
|
|
|
|
if (mounted) super.setState(() {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_onSubmit() async {
|
|
|
|
void _onSubmit() async {
|
|
|
|
_validate = true;
|
|
|
|
_transferModel.assetId = _pickedAsset.id;
|
|
|
|
if (!_formKey.currentState.validate()) {
|
|
|
|
_transferModel.destSiteId = _assetDestination.site?.id;
|
|
|
|
setState(() {});
|
|
|
|
_transferModel.destBuildingId = _assetDestination.building?.id;
|
|
|
|
return false;
|
|
|
|
_transferModel.destFloorId = _assetDestination.floor?.id;
|
|
|
|
|
|
|
|
_transferModel.destDepartmentId = _assetDestination.department?.id;
|
|
|
|
|
|
|
|
if (!_formKey.currentState.validate() || !(await _transferModel.validate(context))) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_formKey.currentState.save();
|
|
|
|
_formKey.currentState.save();
|
|
|
|
|
|
|
|
await _deviceTransferProvider.createRequest(context: context, assetDestination: _transferModel, asset: _pickedAsset);
|
|
|
|
// if (!_formModel.validate()) {
|
|
|
|
|
|
|
|
// setState(() {});
|
|
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_isLoading = true;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
// _formModel.sender?.client?.id = _userProvider.user?.clientId;
|
|
|
|
|
|
|
|
int status = await _deviceTransferProvider.createRequest(
|
|
|
|
|
|
|
|
user: _userProvider.user,
|
|
|
|
|
|
|
|
host: _settingProvider.host,
|
|
|
|
|
|
|
|
model: _formModel,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
_isLoading = false;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
if (status >= 200 && status < 300) {
|
|
|
|
|
|
|
|
// Fluttertoast.showToast(
|
|
|
|
|
|
|
|
// msg: _subtitle.requestCompleteSuccessfully,
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// else {
|
|
|
|
|
|
|
|
// String errorMessage = HttpStatusManger.getStatusMessage(status: status, subtitle: _subtitle);
|
|
|
|
|
|
|
|
// ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
|
|
|
|
|
|
|
// content: Text(errorMessage),
|
|
|
|
|
|
|
|
// ));
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
void dispose() {
|
|
|
|
_requestedQuantityController.dispose();
|
|
|
|
_requestedQuantityController.dispose();
|
|
|
|
_deviceTransferProvider.reset();
|
|
|
|
_deviceTransferProvider.reset();
|
|
|
|
|
|
|
|
_receiverNameController.dispose();
|
|
|
|
|
|
|
|
_commentsController.dispose();
|
|
|
|
super.dispose();
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
_userProvider = Provider.of<UserProvider>(context);
|
|
|
|
_userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
_settingProvider = Provider.of<SettingProvider>(context);
|
|
|
|
_settingProvider = Provider.of<SettingProvider>(context, listen: false);
|
|
|
|
_deviceTransferProvider = Provider.of<AssetTransferProvider>(context, listen: false);
|
|
|
|
_deviceTransferProvider = Provider.of<AssetTransferProvider>(context, listen: false);
|
|
|
|
return Scaffold(
|
|
|
|
return Scaffold(
|
|
|
|
key: _scaffoldKey,
|
|
|
|
key: _scaffoldKey,
|
|
|
|
|
|
|
|
appBar: DefaultAppBar(title: context.translation.newTransferRequest),
|
|
|
|
body: Form(
|
|
|
|
body: Form(
|
|
|
|
key: _formKey,
|
|
|
|
key: _formKey,
|
|
|
|
child: SafeArea(
|
|
|
|
child: SafeArea(
|
|
|
|
child: LoadingManager(
|
|
|
|
child: Column(
|
|
|
|
isLoading: _isLoading,
|
|
|
|
children: [
|
|
|
|
isFailedLoading: false,
|
|
|
|
SingleChildScrollView(
|
|
|
|
stateCode: 200,
|
|
|
|
child: Column(
|
|
|
|
onRefresh: () async {},
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
children: [
|
|
|
|
padding: EdgeInsets.all(12 * AppStyle.getScaleFactor(context)),
|
|
|
|
16.height,
|
|
|
|
child: Column(
|
|
|
|
PickAsset(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
device: _pickedAsset,
|
|
|
|
children: [
|
|
|
|
onPickAsset: (asset) {
|
|
|
|
Center(
|
|
|
|
_pickedAsset = asset;
|
|
|
|
child: Padding(
|
|
|
|
setState(() {});
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
),
|
|
|
|
"Transfer Asset",
|
|
|
|
16.height,
|
|
|
|
style: Theme.of(context).textTheme.headline5.copyWith(color: Theme.of(context).primaryColor, fontSize: 28, fontWeight: FontWeight.bold),
|
|
|
|
context.translation.receiverDetails.heading5(context),
|
|
|
|
),
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
|
|
|
controller: _receiverNameController,
|
|
|
|
|
|
|
|
labelText: context.translation.receiverName,
|
|
|
|
|
|
|
|
validator: (text) => Validator.hasValue(text) ? null : context.translation.requiredField,
|
|
|
|
|
|
|
|
onSaved: (text) {},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
SingleItemDropDownMenu<Site, SiteProvider>(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
title: context.translation.destinationSite,
|
|
|
|
|
|
|
|
initialValue: _assetDestination?.site,
|
|
|
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
|
|
|
_assetDestination.site = value;
|
|
|
|
|
|
|
|
_assetDestination.building = null;
|
|
|
|
|
|
|
|
_assetDestination.floor = null;
|
|
|
|
|
|
|
|
_assetDestination.department = null;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
SingleItemDropDownMenu<Building, NullableLoadingProvider>(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
title: context.translation.building,
|
|
|
|
|
|
|
|
initialValue: _assetDestination?.building,
|
|
|
|
|
|
|
|
enabled: _assetDestination?.site?.buildings?.isNotEmpty ?? false,
|
|
|
|
|
|
|
|
staticData: _assetDestination?.site?.buildings ?? [],
|
|
|
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
|
|
|
_assetDestination?.building = value;
|
|
|
|
|
|
|
|
_assetDestination?.floor = null;
|
|
|
|
|
|
|
|
_assetDestination?.department = null;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
SingleItemDropDownMenu<Floor, NullableLoadingProvider>(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
title: context.translation.floor,
|
|
|
|
|
|
|
|
initialValue: _assetDestination?.floor,
|
|
|
|
|
|
|
|
enabled: _assetDestination?.building?.floors?.isNotEmpty ?? false,
|
|
|
|
|
|
|
|
staticData: _assetDestination?.building?.floors ?? [],
|
|
|
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
|
|
|
_assetDestination?.floor = value;
|
|
|
|
|
|
|
|
_assetDestination?.department = null;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
SingleItemDropDownMenu<Department, NullableLoadingProvider>(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
title: context.translation.department,
|
|
|
|
|
|
|
|
initialValue: _assetDestination?.department,
|
|
|
|
|
|
|
|
enabled: _assetDestination?.floor?.departments?.isNotEmpty ?? false,
|
|
|
|
|
|
|
|
staticData: _assetDestination?.floor?.departments ?? [],
|
|
|
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
|
|
|
_assetDestination?.department = value;
|
|
|
|
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
16.height,
|
|
|
|
// const SizedBox(height: 8,),
|
|
|
|
context.translation.comments.heading5(context),
|
|
|
|
// ASubTitle(_subtitle.title),
|
|
|
|
8.height,
|
|
|
|
// if(_validate && _formModel.title == null || _formModel.title?.isEmpty == true)
|
|
|
|
AppTextFormField(
|
|
|
|
// ASubTitle(_subtitle.requiredWord,color: Colors.red,),
|
|
|
|
controller: _commentsController,
|
|
|
|
// const SizedBox(height: 4,),
|
|
|
|
labelText: context.translation.comments,
|
|
|
|
// ATextFormField(
|
|
|
|
onSaved: (text) {
|
|
|
|
// initialValue: _formModel?.title,
|
|
|
|
_transferModel.senderComment = text;
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
},
|
|
|
|
// style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
|
|
|
// textInputType: TextInputType.text,
|
|
|
|
|
|
|
|
// onSaved: (value){
|
|
|
|
|
|
|
|
// _formModel.title = value;
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
12.height,
|
|
|
|
|
|
|
|
const ASubTitle("Asset"),
|
|
|
|
|
|
|
|
if (_validate /*&& _formModel.device == null*/)
|
|
|
|
|
|
|
|
ASubTitle(
|
|
|
|
|
|
|
|
context.translation.requiredWord,
|
|
|
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
6.height,
|
|
|
|
100.height,
|
|
|
|
// DeviceButton(
|
|
|
|
],
|
|
|
|
// device: _formModel.device,
|
|
|
|
),
|
|
|
|
// onDevicePick: (device) {
|
|
|
|
).expanded,
|
|
|
|
// _formModel.device = device;
|
|
|
|
AppFilledButton(label: context.translation.submitRequest, maxWidth: true, onPressed: _onSubmit)
|
|
|
|
// _formModel.sender.client = device.hospital;
|
|
|
|
],
|
|
|
|
// setState(() {});
|
|
|
|
).paddingOnly(start: 16, end: 16, bottom: 24),
|
|
|
|
// },
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// if (_formModel.device != null) 8.height,
|
|
|
|
|
|
|
|
// if (_formModel.device != null) AdditionalAssetInfo(title: "Asset Site", value: _formModel.device.hospital?.name),
|
|
|
|
|
|
|
|
// if (_formModel.device != null) 4.height,
|
|
|
|
|
|
|
|
// if (_formModel.device != null) AdditionalAssetInfo(title: "Asset Department", value: _formModel.device.destDepartmentName),
|
|
|
|
|
|
|
|
// if (_formModel.device != null) 4.height,
|
|
|
|
|
|
|
|
// if (_formModel.device != null) AdditionalAssetInfo(title: "Asset Floor", value: _formModel.device.destFloor),
|
|
|
|
|
|
|
|
// if (_formModel.device != null) 4.height,
|
|
|
|
|
|
|
|
// if (_formModel.device != null) AdditionalAssetInfo(title: "Asset Room", value: _formModel.device.destRoom),
|
|
|
|
|
|
|
|
// if (_formModel.device != null) 8.height,
|
|
|
|
|
|
|
|
// const SizedBox(height: 8,),
|
|
|
|
|
|
|
|
// const ASubTitle("Sender Department"),
|
|
|
|
|
|
|
|
// if(_validate && _formModel.senderDepartment == null)
|
|
|
|
|
|
|
|
// ASubTitle(_subtitle.requiredWord,color: Colors.red,),
|
|
|
|
|
|
|
|
// const SizedBox(height: 4,),
|
|
|
|
|
|
|
|
// DepartmentButton(
|
|
|
|
|
|
|
|
// department: _formModel.senderDepartment,
|
|
|
|
|
|
|
|
// onDepartmentPick: (department){
|
|
|
|
|
|
|
|
// _formModel.senderDepartment = department;
|
|
|
|
|
|
|
|
// setState(() {});
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// 12.height,
|
|
|
|
|
|
|
|
// const ASubTitle("Destination Client"),
|
|
|
|
|
|
|
|
// if (_validate && _formModel.receiver.client == null)
|
|
|
|
|
|
|
|
// ASubTitle(
|
|
|
|
|
|
|
|
// _subtitle.requiredWord,
|
|
|
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// 6.height,
|
|
|
|
|
|
|
|
// HospitalButton(
|
|
|
|
|
|
|
|
// hospital: _formModel.receiver.client,
|
|
|
|
|
|
|
|
// onHospitalPick: (hospital) {
|
|
|
|
|
|
|
|
// _formModel.receiver.client = hospital;
|
|
|
|
|
|
|
|
// setState(() {});
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// 12.height,
|
|
|
|
|
|
|
|
// const ASubTitle("Destination Department"),
|
|
|
|
|
|
|
|
// if (_validate && _formModel.receiver.department == null)
|
|
|
|
|
|
|
|
// ASubTitle(
|
|
|
|
|
|
|
|
// _subtitle.requiredWord,
|
|
|
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// 6.height,
|
|
|
|
|
|
|
|
// DepartmentButton(
|
|
|
|
|
|
|
|
// department: _formModel.receiver.department,
|
|
|
|
|
|
|
|
// onDepartmentPick: (department) {
|
|
|
|
|
|
|
|
// _formModel.receiver.department = department;
|
|
|
|
|
|
|
|
// setState(() {});
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 4,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Divider(
|
|
|
|
|
|
|
|
color: Theme.of(context).colorScheme.primary,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
|
|
|
const ASubTitle("Destination"),
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 4,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
HospitalAutoCompleteField(
|
|
|
|
|
|
|
|
initialValue: _deviceTransferProvider.hospital?.name,
|
|
|
|
|
|
|
|
// onSave: (value){
|
|
|
|
|
|
|
|
// _search.hospital = value;
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
onSearch: (value) {
|
|
|
|
|
|
|
|
_deviceTransferProvider.hospital = value;
|
|
|
|
|
|
|
|
_deviceTransferProvider.building = null;
|
|
|
|
|
|
|
|
_deviceTransferProvider.floor = null;
|
|
|
|
|
|
|
|
_deviceTransferProvider.department = null;
|
|
|
|
|
|
|
|
// _formModel.receiver.client = value;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 8,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
BuildingTypeMenu(
|
|
|
|
|
|
|
|
initialValue: _deviceTransferProvider?.building,
|
|
|
|
|
|
|
|
building: _deviceTransferProvider?.hospital?.buildings,
|
|
|
|
|
|
|
|
onSelect: (status) {
|
|
|
|
|
|
|
|
_deviceTransferProvider.building = status;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
|
|
|
FloorTypeMenu(
|
|
|
|
|
|
|
|
initialValue: _deviceTransferProvider?.floor,
|
|
|
|
|
|
|
|
floors: _deviceTransferProvider?.building?.floors,
|
|
|
|
|
|
|
|
onSelect: (status) {
|
|
|
|
|
|
|
|
_deviceTransferProvider.floor = status;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
|
|
|
DepartmentTypeMenu(
|
|
|
|
|
|
|
|
initialValue: _deviceTransferProvider?.department,
|
|
|
|
|
|
|
|
departments: _deviceTransferProvider?.floor?.departments,
|
|
|
|
|
|
|
|
onSelect: (status) {
|
|
|
|
|
|
|
|
_deviceTransferProvider.department = status;
|
|
|
|
|
|
|
|
// _formModel.receiver.department = Department(id: status.id, name: status.name);
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
|
|
|
const ASubTitle("Room"),
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 4,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
ATextFormField(
|
|
|
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
|
|
|
controller: _requestedQuantityController,
|
|
|
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
|
|
|
validator: (value) => Validator.isNumeric(value) ? null : "allow numbers only",
|
|
|
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
|
|
|
_deviceTransferProvider.room = value;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
12.height,
|
|
|
|
|
|
|
|
AButton(
|
|
|
|
|
|
|
|
text: context.translation.submit,
|
|
|
|
|
|
|
|
onPressed: _onSubmit,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 100,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class AdditionalAssetInfo extends StatelessWidget {
|
|
|
|
|
|
|
|
final String title, value;
|
|
|
|
|
|
|
|
const AdditionalAssetInfo({@required this.title, @required this.value, Key key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
ASubTitle(title ?? ""),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 16),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
color: AColors.inputFieldBackgroundColor,
|
|
|
|
|
|
|
|
border: Border.all(
|
|
|
|
|
|
|
|
color: const Color(0xffefefef),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: ASubTitle(value ?? ""),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|