fault description is disabled when create new work order

main_design2.0
zaid_daoud 2 years ago
parent 29c5f0e5cf
commit 7a02b2e715

@ -545,6 +545,7 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
ServiceReportFaultDescription(
requestId: widget.request?.id,
initialValue: _serviceReport.faultDescription,
enabled: false,
onSelect: (status) {
_serviceReport.faultDescription = status;
setState(() {});

@ -13,8 +13,9 @@ class ServiceReportFaultDescription extends StatelessWidget {
final String requestId;
final Function(FaultDescription) onSelect;
final FaultDescription initialValue;
final bool enabled;
const ServiceReportFaultDescription({Key key, this.requestId, this.onSelect, this.initialValue}) : super(key: key);
const ServiceReportFaultDescription({Key key, this.requestId, this.onSelect, this.initialValue, this.enabled = true}) : super(key: key);
@override
Widget build(BuildContext context) {
SettingProvider settingProvider = Provider.of<SettingProvider>(context);
@ -28,9 +29,9 @@ class ServiceReportFaultDescription extends StatelessWidget {
menuProvider.reset();
await menuProvider.getCallRequestForWorkOrder(user: userProvider.user, host: settingProvider.host, requestId: requestId);
},
child: (menuProvider.items?.isEmpty ?? true)
? const ATextFormField(
initialValue: "",
child: ((menuProvider.items?.isEmpty ?? true) || (!enabled))
? ATextFormField(
initialValue: (!enabled) ? initialValue?.defectName ?? "" : "",
enable: false,
)
: FaultDescriptionMenu(

Loading…
Cancel
Save