import 'package:flutter/material.dart';
import 'package:provider/provider.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';

class ServiceReportAssistantEmployeeMenu extends StatelessWidget {
  final Function(AssistantEmployees) onSelect;
  final AssistantEmployees initialValue;
  const ServiceReportAssistantEmployeeMenu({Key key, @required this.onSelect, this.initialValue}) : super(key: key);
  @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();
      },
      child: AssistantEmployeeMenu(
        initialStatus: initialValue,
        statuses: menuProvider.assistantEmployees,
        onSelect: onSelect,
      ),
    );
  }
}
