import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/patient_profile_card_model.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart';
import 'package:flutter/material.dart';

import '../../../../routes.dart';

class ProfileGridForSearch extends StatelessWidget {
  final PatiantInformtion? patient;
  final String? patientType;
  final String? arrivalType;
  final double? height;
  final bool isInpatient;
  String? from;
  String? to;

  ProfileGridForSearch({Key? key, this.patient, this.patientType, this.arrivalType, this.height, this.isInpatient = false, this.from, this.to}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final List<PatientProfileCardModel> cardsList = [
      PatientProfileCardModel(
        TranslationBase.of(context).vital,
        TranslationBase.of(context).signs,
        VITAL_SIGN_DETAILS,
        'assets/images/svgs/profile_screen/vital signs.svg',
        isInPatient: isInpatient,
        //onTap: () {},
      ),
      PatientProfileCardModel(
        TranslationBase.of(context).lab,
        TranslationBase.of(context).result,
        LAB_RESULT,
        'assets/images/svgs/profile_screen/lab results.svg',
        isInPatient: isInpatient,
        //onTap: () {},
      ),
      PatientProfileCardModel(
        TranslationBase.of(context).lab,
        TranslationBase.of(context).special,
        ALL_SPECIAL_LAB_RESULT,
        'assets/images/svgs/profile_screen/lab results.svg',
        isInPatient: isInpatient,
        //onTap: () {},
      ),
      PatientProfileCardModel(
        TranslationBase.of(context).radiology,
        TranslationBase.of(context).service,
        RADIOLOGY_PATIENT,
        'assets/images/svgs/profile_screen/health summary.svg',
        isInPatient: isInpatient,
        //onTap: () {},
      ),
      PatientProfileCardModel(
        TranslationBase.of(context).orders,
        TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})',
        ORDER_PRESCRIPTION_OLD,
        'assets/images/svgs/profile_screen/order prescription.svg',
        isInPatient: isInpatient,
        //onTap: () {},
      ),
      PatientProfileCardModel(
        TranslationBase.of(context).patient,
        TranslationBase.of(context).prescription,
        ORDER_PRESCRIPTION_NEW,
        'assets/images/svgs/profile_screen/order prescription.svg',
        isInPatient: isInpatient,
        //onTap: () {},
      ),
      PatientProfileCardModel(
        TranslationBase.of(context).health,
        TranslationBase.of(context).summary,
        HEALTH_SUMMARY,
        'assets/images/svgs/profile_screen/health summary.svg',
        isInPatient: isInpatient,
        //onTap: () {},
      ),
      PatientProfileCardModel(
        TranslationBase.of(context).patient,
        "ECG",
        PATIENT_ECG,
        'assets/images/svgs/profile_screen/ECG.svg',
        isInPatient: isInpatient,
        //onTap: () {},
      ),
      PatientProfileCardModel(
        TranslationBase.of(context).orders,
        TranslationBase.of(context).procedures,
        ORDER_PROCEDURE,
        'assets/images/svgs/profile_screen/Order Procedures.svg',
        isInPatient: isInpatient,
        //onTap: () {},
      ),
      PatientProfileCardModel(
        TranslationBase.of(context).insurance,
        TranslationBase.of(context).service,
        PATIENT_INSURANCE_APPROVALS_NEW,
        'assets/images/svgs/profile_screen/vital signs.svg',
        isInPatient: isInpatient,
        //onTap: () {},
      ),
      PatientProfileCardModel(
        TranslationBase.of(context).patientSick,
        TranslationBase.of(context).leave,
        ADD_SICKLEAVE,
        'assets/images/svgs/profile_screen/patient sick leave.svg',
        isInPatient: isInpatient,
        //onTap: () {},
      ),
      if (patient!.appointmentNo != null && patient!.appointmentNo != 0)
        PatientProfileCardModel(
          TranslationBase.of(context).patient,
          TranslationBase.of(context).ucaf,
          PATIENT_UCAF_REQUEST,
          'assets/images/svgs/profile_screen/UCAF.svg',
          isInPatient: isInpatient,
          isDisable: patient!.patientStatusType != 43 ? true : false,
          //onTap: () {},
        ),
      if (patient!.appointmentNo != null && patient!.appointmentNo != 0)
        PatientProfileCardModel(
          TranslationBase.of(context).referral,
          TranslationBase.of(context).patient,
          REFER_PATIENT_TO_DOCTOR,
          'assets/images/svgs/profile_screen/refer patient.svg',
          isInPatient: isInpatient,
          isDisable: patient!.patientStatusType != 43 ? true : false,
          //onTap: () {},
        ),
      if (patient!.appointmentNo != null && patient!.appointmentNo != 0)
        PatientProfileCardModel(
          TranslationBase.of(context).admission,
          TranslationBase.of(context).request,
          PATIENT_ADMISSION_REQUEST,
          'assets/images/svgs/profile_screen/admission req.svg',
          isInPatient: isInpatient,
          isDisable: patient!.patientStatusType != 43 ? true : false,
          //onTap: () {},
        ),
    ];

    return Padding(
      padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15),
      child: GridView(
        shrinkWrap: true,

        physics: BouncingScrollPhysics(),
        // if you want IOS bouncing effect, otherwise remove this line
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisSpacing: 10,
          mainAxisSpacing: 8,
          crossAxisCount: 3,
        ),
        //change the number as you want
        children: cardsList.map((item) {
          return PatientProfileButton(
            patient: patient!,
            patientType: patientType!,
            arrivalType: arrivalType!,
            from: from!,
            to: to!,
            nameLine1: item.nameLine1,
            nameLine2: item.nameLine2,
            route: item.route,
            icon: item.icon,
            isInPatient: item.isInPatient,
            isDischargedPatient: item.isDischargedPatient,
            isDisable: item.isDisable,
            onTap:item.onTap,
            isLoading: item.isLoading,
          );
        }).toList(),
      ),
    );
  }
}
