|
|
|
|
@ -1,42 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart';
|
|
|
|
|
import 'package:test_sa/providers/loading_list_notifier.dart';
|
|
|
|
|
import 'package:test_sa/models/new_models/assistant_employee.dart';
|
|
|
|
|
import 'package:test_sa/models/service_request/search_work_order.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/status/assistant_employee_menu.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../../controllers/providers/api/status_drop_down/report/service_report_assistants_employee_provider.dart';
|
|
|
|
|
import '../../../../models/new_models/assistant_employee.dart';
|
|
|
|
|
|
|
|
|
|
class ServiceReportAssistantEmployeeMenu extends StatefulWidget {
|
|
|
|
|
class ServiceReportAssistantEmployeeMenu extends StatelessWidget {
|
|
|
|
|
final Function(AssistantEmployees) onSelect;
|
|
|
|
|
final AssistantEmployees initialValue;
|
|
|
|
|
|
|
|
|
|
final String title;
|
|
|
|
|
final num assetId;
|
|
|
|
|
final bool enabled;
|
|
|
|
|
|
|
|
|
|
const ServiceReportAssistantEmployeeMenu({Key key, this.enabled = true, @required this.onSelect, @required this.assetId, this.title, this.initialValue}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<ServiceReportAssistantEmployeeMenu> createState() => _ServiceReportAssistantEmployeeMenuState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _ServiceReportAssistantEmployeeMenuState extends State<ServiceReportAssistantEmployeeMenu> {
|
|
|
|
|
AssistantEmployees _initialValue;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
_initialValue = widget.initialValue;
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
final bool enable;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void didUpdateWidget(covariant ServiceReportAssistantEmployeeMenu oldWidget) {
|
|
|
|
|
if (widget.initialValue != oldWidget.initialValue) {
|
|
|
|
|
_initialValue = widget.initialValue;
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
super.didUpdateWidget(oldWidget);
|
|
|
|
|
}
|
|
|
|
|
const ServiceReportAssistantEmployeeMenu({Key key, @required this.onSelect,this.title, this.initialValue, this.assetId, this.enable = true}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -46,22 +27,87 @@ class _ServiceReportAssistantEmployeeMenuState extends State<ServiceReportAssist
|
|
|
|
|
isFailedLoading: menuProvider.assistantEmployees == null,
|
|
|
|
|
stateCode: menuProvider.stateCode,
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
await menuProvider.getAssistantEmployees(widget.assetId);
|
|
|
|
|
await menuProvider.getAssistantEmployees(assetId);
|
|
|
|
|
// menuProvider.setStateCode = null;
|
|
|
|
|
},
|
|
|
|
|
child: SingleItemDropDownMenu<AssistantEmployees, NullableLoadingProvider>(
|
|
|
|
|
title: widget.title,
|
|
|
|
|
context: context,
|
|
|
|
|
enabled: widget.enabled,
|
|
|
|
|
initialValue: _initialValue,
|
|
|
|
|
staticData: menuProvider.assistantEmployees,
|
|
|
|
|
onSelect: widget.onSelect,
|
|
|
|
|
child: AssistantEmployeeMenu(
|
|
|
|
|
initialStatus: initialValue,
|
|
|
|
|
title: title,
|
|
|
|
|
statuses: menuProvider.assistantEmployees,
|
|
|
|
|
onSelect: onSelect,
|
|
|
|
|
enable: enable,
|
|
|
|
|
),
|
|
|
|
|
// child: AssistantEmployeeMenu(
|
|
|
|
|
// title: title,
|
|
|
|
|
// initialStatus: initialValue,
|
|
|
|
|
// statuses: menuProvider.assistantEmployees,
|
|
|
|
|
// onSelect: onSelect,
|
|
|
|
|
// ),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// import 'package:flutter/material.dart';
|
|
|
|
|
// import 'package:provider/provider.dart';
|
|
|
|
|
// import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart';
|
|
|
|
|
// import 'package:test_sa/providers/loading_list_notifier.dart';
|
|
|
|
|
// import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
|
|
|
|
//
|
|
|
|
|
// import '../../../../controllers/providers/api/status_drop_down/report/service_report_assistants_employee_provider.dart';
|
|
|
|
|
// import '../../../../models/new_models/assistant_employee.dart';
|
|
|
|
|
//
|
|
|
|
|
// class ServiceReportAssistantEmployeeMenu extends StatefulWidget {
|
|
|
|
|
// final Function(AssistantEmployees) onSelect;
|
|
|
|
|
// final AssistantEmployees initialValue;
|
|
|
|
|
// final String title;
|
|
|
|
|
// final num assetId;
|
|
|
|
|
// final bool enabled;
|
|
|
|
|
//
|
|
|
|
|
// const ServiceReportAssistantEmployeeMenu({Key key, this.enabled = true, @required this.onSelect, @required this.assetId, this.title, this.initialValue}) : super(key: key);
|
|
|
|
|
//
|
|
|
|
|
// @override
|
|
|
|
|
// State<ServiceReportAssistantEmployeeMenu> createState() => _ServiceReportAssistantEmployeeMenuState();
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// class _ServiceReportAssistantEmployeeMenuState extends State<ServiceReportAssistantEmployeeMenu> {
|
|
|
|
|
// AssistantEmployees _initialValue;
|
|
|
|
|
//
|
|
|
|
|
// @override
|
|
|
|
|
// void initState() {
|
|
|
|
|
// _initialValue = widget.initialValue;
|
|
|
|
|
// super.initState();
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @override
|
|
|
|
|
// void didUpdateWidget(covariant ServiceReportAssistantEmployeeMenu oldWidget) {
|
|
|
|
|
// if (widget.initialValue != oldWidget.initialValue) {
|
|
|
|
|
// _initialValue = widget.initialValue;
|
|
|
|
|
// setState(() {});
|
|
|
|
|
// }
|
|
|
|
|
// super.didUpdateWidget(oldWidget);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @override
|
|
|
|
|
// Widget build(BuildContext context) {
|
|
|
|
|
// ServiceReportAssistantsEmployeeProvider menuProvider = Provider.of<ServiceReportAssistantsEmployeeProvider>(context);
|
|
|
|
|
// return LoadingManager(
|
|
|
|
|
// isLoading: menuProvider.isLoading,
|
|
|
|
|
// isFailedLoading: menuProvider.assistantEmployees == null,
|
|
|
|
|
// stateCode: menuProvider.stateCode,
|
|
|
|
|
// onRefresh: () async {
|
|
|
|
|
// await menuProvider.getAssistantEmployees(widget.assetId);
|
|
|
|
|
// },
|
|
|
|
|
// child: SingleItemDropDownMenu<AssistantEmployees, NullableLoadingProvider>(
|
|
|
|
|
// title: widget.title,
|
|
|
|
|
// context: context,
|
|
|
|
|
// enabled: widget.enabled,
|
|
|
|
|
// initialValue: _initialValue,
|
|
|
|
|
// staticData: menuProvider.assistantEmployees,
|
|
|
|
|
// onSelect: widget.onSelect,
|
|
|
|
|
// ),
|
|
|
|
|
// // child: AssistantEmployeeMenu(
|
|
|
|
|
// // title: title,
|
|
|
|
|
// // initialStatus: initialValue,
|
|
|
|
|
// // statuses: menuProvider.assistantEmployees,
|
|
|
|
|
// // onSelect: onSelect,
|
|
|
|
|
// // ),
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|