import 'package:cs_resources/constants/color_constants.dart';
import 'package:cs_resources/generated/assets.dart';
import 'package:domain/entity/response/job_applied_staff_s_g_entity.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:plugin_basic/basic_export.dart';
import 'package:widgets/ext/ex_widget.dart';
import 'package:widgets/my_load_image.dart';
import 'package:widgets/my_text_view.dart';

/**
 * 已申请的员工列表Item
 */
class AppliedStaffItem extends StatelessWidget {
  final int index;
  final JobAppliedStaffSGRows item;
  final VoidCallback? onItemAction;

  AppliedStaffItem({
    required this.index,
    required this.item,
    this.onItemAction,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(vertical: 23, horizontal: 21),
      margin: EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5),
      decoration: BoxDecoration(
        color: Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
        borderRadius: BorderRadius.circular(5), // 设置圆角
      ),
      child: Column(
        mainAxisSize: MainAxisSize.max,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          //员工姓名
          Row(
            mainAxisSize: MainAxisSize.max,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              MyTextView(
                "Name:".tr,
                isFontRegular: true,
                textColor: ColorConstants.textGrayAECAE5,
                fontSize: 14,
              ),

              //姓名
              MyTextView(
                item.name ?? "-",
                isFontMedium: true,
                textColor: ColorConstants.white,
                fontSize: 14,
                marginLeft: 5,
                marginRight: 5,
              ).expanded(),

              //是否选中
              MyAssetImage(
                item.isSelected || item.applyState == 1 ? Assets.baseServiceItemSelectedIcon : Assets.baseServiceItemUnselectedIcon,
                width: 20.5,
                height: 20.5,
              ),
            ],
          ),

          // 性别
          Row(
            mainAxisSize: MainAxisSize.max,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              MyTextView(
                "Gender".tr + ":",
                isFontRegular: true,
                textColor: ColorConstants.textGrayAECAE5,
                fontSize: 14,
              ),
              MyTextView(
                item.gender ?? "-",
                marginLeft: 5,
                isFontRegular: true,
                textColor: Colors.white,
                fontSize: 14,
              ).expanded(),
            ],
          ).marginOnly(top: 12),

          // 身份证
          Row(
            mainAxisSize: MainAxisSize.max,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              MyTextView(
                "Nric".tr + ":",
                isFontRegular: true,
                textColor: ColorConstants.textGrayAECAE5,
                fontSize: 14,
              ),

              //时间
              MyTextView(
                item.nric ?? "-",
                marginLeft: 5,
                isFontRegular: true,
                textColor: Colors.white,
                fontSize: 14,
              ).expanded(),
            ],
          ).marginOnly(top: 12),

          // 头像
          Row(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              MyTextView(
                "Avatar".tr + ":",
                isFontRegular: true,
                textColor: ColorConstants.textGrayAECAE5,
                fontSize: 14,
                marginRight: 12,
              ),
              MyLoadImage(item.profilePicture, width: 100, height: 100),
            ],
          ).marginOnly(top: 12),

          // 状态
          Row(
            mainAxisSize: MainAxisSize.max,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              MyTextView(
                "Status:".tr,
                isFontRegular: true,
                textColor: ColorConstants.textGrayAECAE5,
                fontSize: 14,
              ),

              //发布状态
              MyTextView(
                item.status == 1 ? "Active" : "-",
                marginLeft: 5,
                isFontRegular: true,
                textColor: ColorConstants.textBlue06D9FF, //默认蓝色
                fontSize: 14,
              ).expanded(),
            ],
          ).marginOnly(top: 12),
        ],
      ).onTap(() {
        onItemAction?.call();
      }),
    );
  }
}
