//import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class ProcedureCard extends StatelessWidget {
  final Function onTap;
  final EntityList entityList;
  final String categoryName;
  final int categoryID;
  final PatiantInformtion patient;
  final String doctorName;

  const ProcedureCard({
    Key key,
    this.onTap,
    this.entityList,
    this.categoryID,
    this.categoryName,
    this.patient,
    this.doctorName,
  }) : super(key: key);
  @override
  Widget build(BuildContext context) {
    ProjectViewModel projectViewModel = Provider.of(context);

    return Container(
      width: double.maxFinite,
      height: MediaQuery.of(context).size.height * .22,
      margin: EdgeInsets.all(10),
      padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(15),
        color: Colors.white,
      ),
      child: Container(
        child: Row(
          mainAxisAlignment: MainAxisAlignment.start,
          children: [
            Container(
              height: MediaQuery.of(context).size.height * .20,
              width: 5,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.only(
                  topLeft: Radius.circular(10),
                  bottomLeft: Radius.circular(10),
                ),
                color:
                    entityList.orderType == 0 ? Colors.black : Colors.red[500],
              ),
            ),
            Expanded(
              child: Container(
                padding: EdgeInsets.only(
                    left: projectViewModel.isArabic ? 0 : 15,
                    right: projectViewModel.isArabic ? 15 : 0),
                child: InkWell(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Expanded(
                            child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                AppText(
                                  entityList.orderType == 0
                                      ? 'Routine'
                                      : 'Urgent',
                                  color: entityList.orderType == 0
                                      ? Colors.black
                                      : Colors.red[800],
                                  fontWeight: FontWeight.w600,
                                ),
                                SizedBox(
                                  height: 5,
                                ),
                                AppText(
                                  entityList.procedureName,
                                  bold: true,
                                  fontSize: 14,
                                ),
                              ],
                            ),
                          ),
                          SizedBox(
                            width: 5,
                          ),
                          Column(
                            crossAxisAlignment: CrossAxisAlignment.end,
                            mainAxisAlignment: MainAxisAlignment.end,
                            children: [
                              AppText(
                                '${DateUtils.getDayMonthYearDateFormatted(DateUtils.convertISOStringToDateTime(entityList.orderDate), isArabic: projectViewModel.isArabic)}',
                                color: Colors.black,
                                fontWeight: FontWeight.w600,
                                fontSize: 14,
                              ),
                              AppText(
                                '${DateUtils.getHour(DateUtils.convertISOStringToDateTime(entityList.orderDate))}',
                                fontWeight: FontWeight.w600,
                                color: Colors.grey[700],
                                fontSize: 14,
                              ),
                            ],
                          ),
                        ],
                      ),
                      Row(
                        children: [
                          AppText(
                            TranslationBase.of(context).orderNo,
                            //color: Colors.grey,
                            fontSize: 12,
                            color: Colors.grey,
                          ),
                          AppText(
                            entityList.orderNo.toString(),
                            fontSize: 12,
                            bold: true,
                          ),
                        ],
                      ),
                      Row(
                        children: [
                          AppText(
                            TranslationBase.of(context).doctorName + ": ",
                            //color: Colors.grey,
                            fontSize: 12,
                            color: Colors.grey,
                          ),
                          AppText(
                            entityList.doctorName.toString(),
                            fontSize: 12,
                            bold: true,
                          ),
                        ],
                      ),
                      Row(
                        children: [
                          AppText(
                            TranslationBase.of(context).clinic + ": ",
                            //color: Colors.grey,
                            fontSize: 12,
                            color: Colors.grey,
                          ),
                          AppText(
                            entityList.clinicDescription ?? "",
                            bold: true,
                            fontSize: 12,
                          ),
                        ],
                      ),
                      /*Container(
                        alignment: Alignment.centerRight,
                        child: InkWell(
                          onTap: () {
                            Navigator.push(
                              context,
                              FadePage(
                                page: FlowChartPage(
                                  filterName: entityList.procedureName,
                                  patient: patient,
                                ),
                              ),
                            );
                          },
                          child: AppText(
                            TranslationBase.of(context).showMoreBtn,
                            textDecoration: TextDecoration.underline,
                            color: Colors.blue,
                          ),
                        ),
                      ),*/
                      // Row(
                      //   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      //   children: [
                      //     AppText(
                      //       entityList.remarks.toString() ?? '',
                      //       fontSize: 12,
                      //     ),
                      //     if (entityList.categoryID == 2 ||
                      //         entityList.categoryID == 4 &&
                      //             doctorName == entityList.doctorName)
                      //       InkWell(
                      //         child: Icon(DoctorApp.edit),
                      //         onTap: onTap,
                      //       )
                      //   ],
                      // )
                    ],
                  ),
                  //onTap: onTap,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
