123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431 |
- import 'package:cs_resources/constants/color_constants.dart';
- import 'package:cs_resources/generated/assets.dart';
- import 'package:domain/entity/response/job_list_applied_info_entity.dart';
- import 'package:domain/entity/response/job_list_applied_staff_list_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:shared/utils/util.dart';
- import 'package:widgets/ext/ex_widget.dart';
- import 'package:widgets/my_button.dart';
- import 'package:widgets/my_load_image.dart';
- import 'package:widgets/my_text_view.dart';
- /**
- * 已申请的员工列表Item
- */
- class AppliedStaffItem extends StatelessWidget {
- final int index;
- final JobListAppliedInfoEntity? jobInfo;
- final JobListAppliedStaffListRows item;
- final VoidCallback? onStatusAction;
- final VoidCallback? onEditAction;
- final VoidCallback? onRemarkAction;
- final VoidCallback? onItemAction;
- final VoidCallback? onMemberAction;
- AppliedStaffItem({
- required this.index,
- required this.item,
- required this.jobInfo,
- this.onStatusAction,
- this.onRemarkAction,
- this.onEditAction,
- this.onItemAction,
- this.onMemberAction,
- });
- @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(
- "Staff Name:".tr,
- isFontRegular: true,
- textColor: ColorConstants.textGrayAECAE5,
- fontSize: 14,
- ),
- //姓名
- MyTextView(
- item.staffName ?? "-",
- isFontMedium: true,
- textColor: ColorConstants.textYellowFFBB1B,
- fontSize: 14,
- marginLeft: 5,
- marginRight: 5,
- textDecoration: TextDecoration.underline,
- decorationColor: ColorConstants.textYellowFFBB1B,
- // 可选,设置下划线的颜色
- decorationThickness: 2.0,
- // 可选,设置下划线的粗细
- decorationStyle: TextDecorationStyle.solid,
- onClick: onMemberAction,
- ).expanded(),
- //是否选中
- Visibility(
- visible: item.status == 3,
- child: MyAssetImage(
- item.isSelected ? Assets.baseServiceItemSelectedIcon : Assets.baseServiceItemUnselectedIcon,
- width: 20.5,
- height: 20.5,
- ),
- ),
- ],
- ),
- // 工作开始时间
- 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(
- "Security In:".tr,
- isFontRegular: true,
- textColor: ColorConstants.textGrayAECAE5,
- fontSize: 14,
- ),
- //时间
- MyTextView(
- item.securityIn?.time ?? "-",
- marginLeft: 5,
- isFontRegular: true,
- textColor: item.securityIn?.changed == 1 ? ColorConstants.textRedFF6262 : Colors.white,
- fontSize: 14,
- ).expanded(),
- ],
- ).marginOnly(top: 12),
- // 工作地签到时间
- Row(
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- MyTextView(
- "Work In:".tr,
- isFontRegular: true,
- textColor: ColorConstants.textGrayAECAE5,
- fontSize: 14,
- ),
- //时间
- MyTextView(
- item.workIn?.time ?? "-",
- marginLeft: 5,
- isFontRegular: true,
- textColor: item.workIn?.changed == 1 ? ColorConstants.textRedFF6262 : 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(
- "Work Out:".tr,
- isFontRegular: true,
- textColor: ColorConstants.textGrayAECAE5,
- fontSize: 14,
- ),
- //时间
- MyTextView(
- item.workOut?.time ?? "-",
- marginLeft: 5,
- isFontRegular: true,
- textColor: item.workOut?.changed == 1 ? ColorConstants.textRedFF6262 : Colors.white,
- fontSize: 14,
- ).expanded(),
- ],
- ).marginOnly(top: 12),
- // 门卫签出时间
- Row(
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- MyTextView(
- "Security Out:".tr,
- isFontRegular: true,
- textColor: ColorConstants.textGrayAECAE5,
- fontSize: 14,
- ),
- //时间
- MyTextView(
- item.securityOut?.time ?? "-",
- marginLeft: 5,
- isFontRegular: true,
- textColor: item.securityOut?.changed == 1 ? ColorConstants.textRedFF6262 : Colors.white,
- fontSize: 14,
- ).expanded(),
- ],
- ).marginOnly(top: 12),
- // + - Hours
- Visibility(
- visible: jobInfo?.jobUnit == "hour",
- child: Row(
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- MyTextView(
- "+/- Hours:".tr,
- isFontRegular: true,
- textColor: ColorConstants.textGrayAECAE5,
- fontSize: 14,
- ),
- //小时
- MyTextView(
- Utils.isNotEmpty(item.adjustShow) ? item.adjustShow! : "0",
- marginLeft: 5,
- isFontRegular: true,
- textColor: Colors.white,
- fontSize: 14,
- ).expanded(),
- ],
- ).marginOnly(top: 12),
- ),
- // Total Hours
- Visibility(
- visible: jobInfo?.jobUnit == "hour",
- child: Row(
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- MyTextView(
- "Total Hours:".tr,
- isFontRegular: true,
- textColor: ColorConstants.textGrayAECAE5,
- fontSize: 14,
- ),
- //小时
- MyTextView(
- item.totalShow.toString(),
- marginLeft: 5,
- isFontRegular: true,
- textColor: Colors.white,
- fontSize: 14,
- ).expanded(),
- ],
- ).marginOnly(top: 12),
- ),
- // Total Rooms
- Visibility(
- visible: jobInfo?.jobUnit != "hour",
- child: Row(
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- MyTextView(
- "Total Rooms:".tr,
- isFontRegular: true,
- textColor: ColorConstants.textGrayAECAE5,
- fontSize: 14,
- ),
- //小时
- MyTextView(
- item.totalRooms.toString(),
- marginLeft: 5,
- isFontRegular: true,
- textColor: Colors.white,
- fontSize: 14,
- ).expanded(),
- ],
- ).marginOnly(top: 12),
- ),
- // 申请时间
- Row(
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- MyTextView(
- "Applied At:".tr,
- isFontRegular: true,
- textColor: ColorConstants.textGrayAECAE5,
- fontSize: 14,
- ),
- //发布状态
- MyTextView(
- item.appliedAt ?? "-",
- marginLeft: 5,
- isFontRegular: true,
- textColor: Colors.white,
- fontSize: 14,
- ).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: "Completed" == item.statusShow
- ? ColorConstants.textGreen05DC82
- : "Cancelled" == item.statusShow || "Rejected" == item.statusShow
- ? ColorConstants.textRedFF6262
- : "Revised" == item.statusShow || "Pending" == item.statusShow || "Approve" == item.statusShow
- ? ColorConstants.textYellowFFBB1B
- : ColorConstants.textBlue06D9FF, //默认蓝色
- fontSize: 14,
- ).expanded(),
- ],
- ).marginOnly(top: 12),
- //按钮组
- Visibility(
- visible: item.actionList?.isNotEmpty ?? false,
- child: Row(
- mainAxisSize: MainAxisSize.max,
- mainAxisAlignment: MainAxisAlignment.end,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- //编辑按钮
- Visibility(
- visible: item.actionList?.contains("edit") ?? false,
- child: MyButton(
- onPressed: () {
- FocusScope.of(context).unfocus();
- onEditAction?.call();
- },
- text: "Edit".tr,
- textColor: ColorConstants.white,
- backgroundColor: hexToColor(
- "#FFBB1B",
- ),
- radius: 17.25,
- minWidth: 60,
- minHeight: 35,
- ).marginOnly(left: 12),
- ),
- //状态工作流按钮
- Visibility(
- visible: item.actionList?.contains("status") ?? false,
- child: MyButton(
- onPressed: () {
- FocusScope.of(context).unfocus();
- onStatusAction?.call();
- },
- text: "Status".tr,
- textColor: ColorConstants.white,
- backgroundColor: hexToColor("#0AC074"),
- radius: 17.25,
- minWidth: 60,
- minHeight: 35,
- ).marginOnly(left: 12),
- ),
- //Remark按钮
- Visibility(
- visible: item.actionList?.contains("remarks") ?? false,
- child: MyButton(
- onPressed: () {
- FocusScope.of(context).unfocus();
- onRemarkAction?.call();
- },
- text: "Remarks".tr,
- textColor: ColorConstants.white,
- backgroundColor: hexToColor("#56AAFF"),
- radius: 17.25,
- minWidth: 60,
- minHeight: 35,
- ).marginOnly(left: 12),
- ),
- ],
- ).marginOnly(top: 15),
- ),
- ],
- ).onTap(() {
- onItemAction?.call();
- }),
- );
- }
- }
|