import 'package:cs_resources/constants/color_constants.dart';
import 'package:domain/entity/response/staff_job_history_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_text_view.dart';

/**
 * 员工的做工记录
 */
class StaffLabourHistoryItem extends StatelessWidget {
  final int index;
  final StaffJobHistorySGRows item;

  StaffLabourHistoryItem({
    required this.index,
    required this.item,
  });

  @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(
                "Job Date".tr+":",
                isFontRegular: true,
                textColor: ColorConstants.textGrayAECAE5,
                fontSize: 14,
              ),

              //日期
              MyTextView(
                item.jobDate ?? "-",
                isFontRegular: true,
                textColor: ColorConstants.white,
                fontSize: 14,
                marginLeft: 5,
                marginRight: 5,
              ).expanded(),

            ],
          ),

          // 工作开始时间
          Row(
            mainAxisSize: MainAxisSize.max,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              MyTextView(
                "Start Time:".tr,
                isFontRegular: true,
                textColor: ColorConstants.textGrayAECAE5,
                fontSize: 14,
              ),

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

          //工作结束时间
          Row(
            mainAxisSize: MainAxisSize.max,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              MyTextView(
                "End Time:".tr,
                isFontRegular: true,
                textColor: ColorConstants.textGrayAECAE5,
                fontSize: 14,
              ),

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

          //工作标题（模板）
          Row(
            mainAxisSize: MainAxisSize.max,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              MyTextView(
                "Job Title".tr+":",
                isFontRegular: true,
                textColor: ColorConstants.textGrayAECAE5,
                fontSize: 14,
              ),

              //标题
              MyTextView(
                item.jobTitle ?? "-",
                isFontRegular: true,
                textColor: ColorConstants.white,
                fontSize: 14,
                marginLeft: 5,
                marginRight: 5,
              ).expanded(),

            ],
          ).marginOnly(top: 12),

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

              //部门
              MyTextView(
                item.outletName ?? "-",
                isFontRegular: true,
                textColor: ColorConstants.white,
                fontSize: 14,
                marginLeft: 5,
                marginRight: 5,
              ).expanded(),

            ],
          ).marginOnly(top: 12),

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

              //发布状态
              MyTextView(
                item.statusShow ?? "-",
                marginLeft: 5,
                isFontRegular: true,
                textColor: Colors.white ,
                fontSize: 14,
              ).expanded(),
            ],
          ).marginOnly(top: 12),

        ],
      ),
    );
  }
}
