import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';


class ProgressNoteItem extends StatelessWidget {
  final String type;
  final String speciality;
  final String Notes;
  final String patientCondition;
  final String doctorName;
  final String modifiedOn;

  const ProgressNoteItem(
      {super.key,
      required this.type,
      required this.speciality,
      required this.Notes,
      required this.patientCondition,
      required this.doctorName,
      required this.modifiedOn,
      });

  @override
  Widget build(BuildContext context) => Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
              Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Row(
                      children: [
                        AppText(
                          "${TranslationBase.of(context).type}:",
                          color: Color(0XFF2B353E),
                          fontSize: 10,
                          fontWeight: FontWeight.w500,
                        ),
                        SizedBox(
                          width: 4,
                        ),
                        AppText(
                          type,
                          color: Color(0XFF2B353E),
                          fontSize: 10,
                          fontWeight: FontWeight.w500,
                        ),
                      ],
                    ),
                    SizedBox(
                      height: 4,
                    ),
                    Row(
                      children: [
                        AppText(
                          "${TranslationBase.of(context).speciality}:",
                          color: Color(0XFF2B353E),
                          fontSize: 10,
                          fontWeight: FontWeight.w500,
                        ),
                        SizedBox(
                          width: 4,
                        ),
                        AppText(
                          speciality,
                          color: Color(0XFF2B353E),
                          fontSize: 10,
                          fontWeight: FontWeight.w500,
                        ),
                      ],
                    ),
                    SizedBox(
                      height: 4,
                    ),
                    Row(
                      children: [
                        AppText(
                          "${TranslationBase.of(context).doctorName}:",
                          color: Color(0XFF2B353E),
                          fontSize: 10,
                          fontWeight: FontWeight.w500,
                        ),
                        SizedBox(
                          width: 4,
                        ),
                        AppText(
                          doctorName,
                          color: Color(0XFF2B353E),
                          fontSize: 10,
                          fontWeight: FontWeight.w500,
                        ),
                      ],
                    ),
                    SizedBox(
                      height: 4,
                    ),
                    Row(
                      children: [
                        AppText(
                          "${TranslationBase.of(context).dateTime}",
                          color: Color(0XFF2B353E),
                          fontSize: 10,
                          fontWeight: FontWeight.w500,
                        ),
                        SizedBox(
                          width: 4,
                        ),
                        AppText(
                          getDateAndTime(modifiedOn),
                          color: Color(0XFF2B353E),
                          fontSize: 10,
                          fontWeight: FontWeight.w500,
                        ),
                      ],
                    ),
                  ],
                ),
              ),
              Visibility(
                  visible: patientCondition.isNotEmpty,
                  child: Status(status: patientCondition))
            ],
          ),
          SizedBox(
            height: 8,
          ),
          AppText(
            Notes,
            color: Color(0XFF2B353E),
            fontSize: 12,
            fontWeight: FontWeight.w600,
          ),
        ],
      );

  String getDateAndTime(String dateTime) {
    if (dateTime.isEmpty) return '';
    DateTime now = DateTime.now();
    return DateFormat('dd/MM/yyyy hh:mm a').format(now);
  }
}
