import 'package:cs_resources/generated/assets.dart';
import 'package:cs_resources/generated/l10n.dart';
import 'package:cs_resources/theme/app_colors_theme.dart';
import 'package:domain/entity/form_submitted_entity.dart';
import 'package:flutter/material.dart';
import 'package:widgets/ext/ex_widget.dart';
import 'package:widgets/my_load_image.dart';
import 'package:widgets/my_text_view.dart';
import 'package:widgets/utils/dark_theme_util.dart';

import '../form_types.dart';


class FormNotApproveItem extends StatelessWidget {
  final int index;
  final FormSubmittedEntity item;

  const FormNotApproveItem({
    required this.index,
    required this.item,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      margin: const EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5),
      padding: const EdgeInsets.only(left: 20, right: 15, top: 18, bottom: 20),
      decoration: BoxDecoration(
        color: context.appColors.whiteBG,
        borderRadius: BorderRadius.circular(6.0), // 圆角
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              MyAssetImage(
                FormTypes.iconMap[item.estateOnlineForm?.type?.id]?['icon_path'],
                width: FormTypes.iconMap[item.estateOnlineForm?.type?.id]?['width'],
                height: FormTypes.iconMap[item.estateOnlineForm?.type?.id]?['height'],
                color: DarkThemeUtil.multiColors(context, AppColorsTheme.colorPrimary, darkColor: Colors.white),
              ),
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  MyTextView(
                    FormTypes.iconMap[item.estateOnlineForm?.type?.id]?['name'],
                    fontSize: 16,
                    maxLines: 2,
                    textColor: context.appColors.textBlack,
                    isFontMedium: true,
                  ),

                  //预订人
                  MyTextView(
                    S.current.booked_by_someone(item.account?.name ?? ""),
                    fontSize: 14,
                    marginTop: 2,
                    textColor: context.appColors.textBlack,
                    isFontRegular: true,
                  ),
                ],
              ).marginOnly(left: 11, right: 11).expanded(),

              MyTextView(
                item.order?.refundStatus != 0
                    ? S.current.refunded
                    : item.order?.paymentStatus == 1
                    ? S.current.paid
                    : S.current.unpaid,
                textColor: item.order?.refundStatus != 0
                    ? context.appColors.textDisEnableGray
                    : item.order?.paymentStatus == 1
                    ? context.appColors.textPrimary
                    : context.appColors.deleteRed,
                cornerRadius: 3,
                borderWidth: 0.5,
                borderColor: item.order?.refundStatus != 0
                    ? context.appColors.textDisEnableGray
                    : item.order?.paymentStatus == 1
                    ? context.appColors.textPrimary
                    : context.appColors.deleteRed,
                paddingTop: 3,
                paddingBottom: 3,
                paddingLeft: 15,
                paddingRight: 15,
                textAlign: TextAlign.center,
              ),
            ],
          ),
          MyTextView(
            S.current.send_on_sometime(item.sentOn ?? ""),
            fontSize: 14,
            marginTop: 10,
            textColor: context.appColors.textBlack,
            isFontRegular: true,
          ),

          MyTextView(
            S.current.not_approved_on_sometime(item.rejectedOn ?? ""),
            fontSize: 14,
            marginTop: 5,
            textColor: context.appColors.textBlack,
            isFontRegular: true,
          ),

        ],
      ),
    );
  }
}
