import 'package:flutter/material.dart';

import '../../../controllers/localization/localization.dart';
import '../../../models/device/device_transfer_info.dart';
import '../../app_style/colors.dart';
import '../loaders/image_loader.dart';
import '../requests/info_row.dart';
import '../requests/request_status.dart';

class DeviceTransferInfoSection extends StatelessWidget {
  final DeviceTransferInfo info;
  final VoidCallback? onEdit;
  const DeviceTransferInfoSection({Key? key, required this.info, this.onEdit}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final subtitle = AppLocalization.of(context)?.subtitle;
    return Column(
      children: [
        RequestInfoRow(
          title: subtitle?.hospital,
          info: info.client?.name,
        ),
        RequestInfoRow(
          title: subtitle?.unite,
          info: info.department?.name,
        ),
        RequestInfoRow(
          title: subtitle?.engineerName,
          info: info.name,
        ),
        RequestInfoRow(
          title: subtitle?.workingHours,
          info: info.workingHours,
        ),
        RequestInfoRow(
          title: subtitle?.travelingHours,
          info: info.travelingHours,
        ),
        RequestInfoRow(
          title: "Comment",
          info: info.comment,
        ),
        RequestInfoRow(
          title: "Signature",
          info: (info.signature?.isEmpty) != false ? subtitle?.noDateFound : "",
          contentWidget: (info.signature?.isEmpty ?? false) != false
              ? Container()
              : ImageLoader(
                  url: info.signature ?? "",
                ),
        ),
        RequestInfoRow(
          title: subtitle?.status,
          infoWidget: StatusLabel(label: info.status!.label, color: AColors.getGasStatusColor(info.status?.id ?? 0)),
        ),
      ],
    );
  }
}
