|
|
|
|
@ -32,10 +32,13 @@ class _FirstActionBottomSheetState extends State<FirstActionBottomSheet> {
|
|
|
|
|
Asset asset;
|
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
|
|
|
|
|
|
Lookup firstAction;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
_serviceRequest = widget.request;
|
|
|
|
|
firstAction = _serviceRequest.firstAction;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -68,25 +71,46 @@ class _FirstActionBottomSheetState extends State<FirstActionBottomSheet> {
|
|
|
|
|
SingleItemDropDownMenu<Lookup, FirstActionStatusProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
title: context.translation.firstActionStatus,
|
|
|
|
|
initialValue: _serviceRequest.firstAction,
|
|
|
|
|
initialValue: firstAction, //_serviceRequest.firstAction,
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_serviceRequest.firstAction = value;
|
|
|
|
|
if (_serviceRequest?.firstAction?.value != 2) {
|
|
|
|
|
//_serviceRequest.firstAction = value;
|
|
|
|
|
firstAction = value;
|
|
|
|
|
if (firstAction.value != 2) {
|
|
|
|
|
_serviceRequest.visitDate = null;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
if (_serviceRequest?.firstAction?.value == 2) 8.height,
|
|
|
|
|
if (_serviceRequest?.firstAction?.value == 2)
|
|
|
|
|
if (firstAction?.value == 2) 8.height,
|
|
|
|
|
if (firstAction?.value == 2)
|
|
|
|
|
ADatePicker(
|
|
|
|
|
label: context.translation.visitDate,
|
|
|
|
|
date: DateTime.tryParse(_serviceRequest.visitDate ?? ""),
|
|
|
|
|
onDatePicker: (date) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_serviceRequest.visitDate = date?.toIso8601String();
|
|
|
|
|
});
|
|
|
|
|
formatDateWithTime: true,
|
|
|
|
|
onDatePicker: (selectedDate) {
|
|
|
|
|
if (selectedDate != null) {
|
|
|
|
|
showTimePicker(
|
|
|
|
|
context: context,
|
|
|
|
|
initialTime: TimeOfDay.now(),
|
|
|
|
|
).then((selectedTime) {
|
|
|
|
|
// Handle the selected date and time here.
|
|
|
|
|
if (selectedTime != null) {
|
|
|
|
|
DateTime selectedDateTime = DateTime(
|
|
|
|
|
selectedDate.year,
|
|
|
|
|
selectedDate.month,
|
|
|
|
|
selectedDate.day,
|
|
|
|
|
selectedTime.hour,
|
|
|
|
|
selectedTime.minute,
|
|
|
|
|
);
|
|
|
|
|
if (selectedDateTime != null) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_serviceRequest.visitDate = selectedDateTime?.toIso8601String();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
@ -131,10 +155,11 @@ class _FirstActionBottomSheetState extends State<FirstActionBottomSheet> {
|
|
|
|
|
Consumer<ServiceRequestsProvider>(
|
|
|
|
|
builder: (context, snapshot, _) => AppFilledButton(
|
|
|
|
|
label: context.translation.save,
|
|
|
|
|
loading: snapshot.isLoading,
|
|
|
|
|
loading: snapshot.isLoading ?? false,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
_formKey.currentState.save();
|
|
|
|
|
_serviceRequest.device = asset;
|
|
|
|
|
_serviceRequest.firstAction = firstAction;
|
|
|
|
|
await snapshot.updateRequest(user: userProvider.user, request: _serviceRequest);
|
|
|
|
|
Navigator.pop(context, true);
|
|
|
|
|
},
|
|
|
|
|
|