///todo deleted
// import 'dart:math';
//
// import 'package:flutter/material.dart';
// import 'package:provider/provider.dart';
// import 'package:test_sa/controllers/providers/api/status_drop_down/report/service_report_equipment_status_provider.dart';
// import 'package:test_sa/controllers/providers/api/status_drop_down/report/service_report_last_calls_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/models/lookup.dart';
// import 'package:test_sa/models/service_request/service_report.dart';
// import 'package:test_sa/models/service_request/service_request.dart';
// import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
// import 'package:test_sa/views/widgets/status/single_status_menu.dart';
//
// class ServiceReportEquipmentStatusMenu extends StatefulWidget {
//   final Function(Lookup) onSelect;
//   final ServiceReport report;
//   final ServiceRequest request;
//
//   const ServiceReportEquipmentStatusMenu({Key? key, this.onSelect, this.report, this.request}) : super(key: key);
//
//   @override
//   State<ServiceReportEquipmentStatusMenu> createState() => _ServiceReportEquipmentStatusMenuState();
// }
//
// class _ServiceReportEquipmentStatusMenuState extends State<ServiceReportEquipmentStatusMenu> {
//   bool firstTime = true;
//
//   @override
//   Widget build(BuildContext context) {
//     SettingProvider settingProvider = Provider.of<SettingProvider>(context);
//     UserProvider userProvider = Provider.of<UserProvider>(context);
//     ServiceReportEquipmentStatusProvider menuProvider = Provider.of<ServiceReportEquipmentStatusProvider>(context);
//     ServiceReportLastCallsProvider callsLastSituationsProvider = Provider.of<ServiceReportLastCallsProvider>(context);
//     if (firstTime) {
//       callsLastSituationsProvider.reset();
//
//       firstTime = false;
//     }
//     return LoadingManager(
//         isLoading: menuProvider.isLoading == true || callsLastSituationsProvider.isLoading == true,
//         isFailedLoading: menuProvider.statuses == null || callsLastSituationsProvider.calls == null,
//         stateCode: menuProvider.stateCode == null || callsLastSituationsProvider.stateCode == null ? null : max(menuProvider.stateCode ?? 0, callsLastSituationsProvider.stateCode ?? 0),
//         onRefresh: () async {
//           await callsLastSituationsProvider.getCalls(
//             typeName: widget.report?.assetType?.name,
//             id: widget.report?.id,
//             parentId: widget.request?.id,
//           );
//           if (menuProvider.stateCode == null) {
//             menuProvider.reset();
//             await menuProvider.getTypes(user: userProvider.user, host: settingProvider.host);
//             setState(() {});
//           }
//         },
//         child: SingleStatusMenu(
//           statuses: menuProvider.statuses,
//           initialStatus: widget.report?.equipmentStatus,
//           onSelect: (status) {
//             widget.report?.calllastSituation = null;
//             callsLastSituationsProvider.getCalls(
//               id: widget.report?.id,
//               parentId: widget.request?.id,
//               typeName: widget.report?.assetType?.name,
//             );
//
//             widget.onSelect(status);
//           },
//         ));
//   }
// }
