import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart';
import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import '../../../../../widgets/shared/errors/error_message.dart';
import '../history/lab_result_history_chart_and_detials.dart';

class FlowChartPage extends StatelessWidget {
  final PatientLabOrders patientLabOrder;
  final String filterName;
  final PatiantInformtion patient;
  final bool isInpatient;

  FlowChartPage(
      {required this.patientLabOrder, required this.filterName, required this.patient, required this.isInpatient});

  @override
  Widget build(BuildContext context) {
    return BaseView<LabsViewModel>(
      onModelReady: (model) => model.getPatientLabResultHistoryByDescription(
          patientLabOrder: patientLabOrder,
          procedureDescription: filterName,
          patient: patient),
      builder: (context, model, w) => AppScaffold(
        isShowAppBar: true,
        appBarTitle: filterName,
        baseViewModel: model,
        body: model.labOrdersResultHistoryList.isNotEmpty
            ? SingleChildScrollView(
                child: Container(
                  child: LabResultHistoryChartAndDetails(
                    name: filterName,
                    labResultHistory: model.labOrdersResultHistoryList,
                  ),
                ),
              )
            : Container(
                child: Center(
                    child: ErrorMessage(
                  error: TranslationBase.of(context).noDataAvailable,
                )),
              ),
      ),
    );
  }
}
