applied_staff_item.dart 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. import 'package:cs_resources/constants/color_constants.dart';
  2. import 'package:cs_resources/generated/assets.dart';
  3. import 'package:domain/entity/response/job_list_applied_info_entity.dart';
  4. import 'package:domain/entity/response/job_list_applied_staff_list_entity.dart';
  5. import 'package:flutter/cupertino.dart';
  6. import 'package:flutter/material.dart';
  7. import 'package:flutter/widgets.dart';
  8. import 'package:plugin_basic/basic_export.dart';
  9. import 'package:shared/utils/util.dart';
  10. import 'package:widgets/ext/ex_widget.dart';
  11. import 'package:widgets/my_button.dart';
  12. import 'package:widgets/my_load_image.dart';
  13. import 'package:widgets/my_text_view.dart';
  14. /**
  15. * 已申请的员工列表Item
  16. */
  17. class AppliedStaffItem extends StatelessWidget {
  18. final int index;
  19. final JobListAppliedInfoEntity? jobInfo;
  20. final JobListAppliedStaffListRows item;
  21. final VoidCallback? onStatusAction;
  22. final VoidCallback? onEditAction;
  23. final VoidCallback? onRemarkAction;
  24. final VoidCallback? onItemAction;
  25. final VoidCallback? onMemberAction;
  26. AppliedStaffItem({
  27. required this.index,
  28. required this.item,
  29. required this.jobInfo,
  30. this.onStatusAction,
  31. this.onRemarkAction,
  32. this.onEditAction,
  33. this.onItemAction,
  34. this.onMemberAction,
  35. });
  36. @override
  37. Widget build(BuildContext context) {
  38. return Container(
  39. padding: EdgeInsets.symmetric(vertical: 23, horizontal: 21),
  40. margin: EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5),
  41. decoration: BoxDecoration(
  42. color: Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
  43. borderRadius: BorderRadius.circular(5), // 设置圆角
  44. ),
  45. child: Column(
  46. mainAxisSize: MainAxisSize.max,
  47. crossAxisAlignment: CrossAxisAlignment.start,
  48. children: [
  49. //员工姓名
  50. Row(
  51. mainAxisSize: MainAxisSize.max,
  52. crossAxisAlignment: CrossAxisAlignment.center,
  53. children: [
  54. MyTextView(
  55. "Staff Name:".tr,
  56. isFontRegular: true,
  57. textColor: ColorConstants.textGrayAECAE5,
  58. fontSize: 14,
  59. ),
  60. //姓名
  61. MyTextView(
  62. item.staffName ?? "-",
  63. isFontMedium: true,
  64. textColor: ColorConstants.textYellowFFBB1B,
  65. fontSize: 14,
  66. marginLeft: 5,
  67. marginRight: 5,
  68. textDecoration: TextDecoration.underline,
  69. decorationColor: ColorConstants.textYellowFFBB1B,
  70. // 可选,设置下划线的颜色
  71. decorationThickness: 2.0,
  72. // 可选,设置下划线的粗细
  73. decorationStyle: TextDecorationStyle.solid,
  74. onClick: onMemberAction,
  75. ).expanded(),
  76. //是否选中
  77. Visibility(
  78. visible: item.status == 3,
  79. child: MyAssetImage(
  80. item.isSelected ? Assets.baseServiceItemSelectedIcon : Assets.baseServiceItemUnselectedIcon,
  81. width: 20.5,
  82. height: 20.5,
  83. ),
  84. ),
  85. ],
  86. ),
  87. // 工作开始时间
  88. Row(
  89. mainAxisSize: MainAxisSize.max,
  90. crossAxisAlignment: CrossAxisAlignment.center,
  91. children: [
  92. MyTextView(
  93. "Start Time:".tr,
  94. isFontRegular: true,
  95. textColor: ColorConstants.textGrayAECAE5,
  96. fontSize: 14,
  97. ),
  98. //时间
  99. MyTextView(
  100. item.startTime ?? "-",
  101. marginLeft: 5,
  102. isFontRegular: true,
  103. textColor: Colors.white,
  104. fontSize: 14,
  105. ).expanded(),
  106. ],
  107. ).marginOnly(top: 12),
  108. // 门卫签到时间
  109. Row(
  110. mainAxisSize: MainAxisSize.max,
  111. crossAxisAlignment: CrossAxisAlignment.center,
  112. children: [
  113. MyTextView(
  114. "Security In:".tr,
  115. isFontRegular: true,
  116. textColor: ColorConstants.textGrayAECAE5,
  117. fontSize: 14,
  118. ),
  119. //时间
  120. MyTextView(
  121. item.securityIn?.time ?? "-",
  122. marginLeft: 5,
  123. isFontRegular: true,
  124. textColor: item.securityIn?.changed == 1 ? ColorConstants.textRedFF6262 : Colors.white,
  125. fontSize: 14,
  126. ).expanded(),
  127. ],
  128. ).marginOnly(top: 12),
  129. // 工作地签到时间
  130. Row(
  131. mainAxisSize: MainAxisSize.max,
  132. crossAxisAlignment: CrossAxisAlignment.center,
  133. children: [
  134. MyTextView(
  135. "Work In:".tr,
  136. isFontRegular: true,
  137. textColor: ColorConstants.textGrayAECAE5,
  138. fontSize: 14,
  139. ),
  140. //时间
  141. MyTextView(
  142. item.workIn?.time ?? "-",
  143. marginLeft: 5,
  144. isFontRegular: true,
  145. textColor: item.workIn?.changed == 1 ? ColorConstants.textRedFF6262 : Colors.white,
  146. fontSize: 14,
  147. ).expanded(),
  148. ],
  149. ).marginOnly(top: 12),
  150. //工作结束时间
  151. Row(
  152. mainAxisSize: MainAxisSize.max,
  153. crossAxisAlignment: CrossAxisAlignment.center,
  154. children: [
  155. MyTextView(
  156. "End Time:".tr,
  157. isFontRegular: true,
  158. textColor: ColorConstants.textGrayAECAE5,
  159. fontSize: 14,
  160. ),
  161. //时间
  162. MyTextView(
  163. item.endTime ?? "-",
  164. marginLeft: 5,
  165. isFontRegular: true,
  166. textColor: Colors.white,
  167. fontSize: 14,
  168. ).expanded(),
  169. ],
  170. ).marginOnly(top: 12),
  171. // 工作地签出时间
  172. Row(
  173. mainAxisSize: MainAxisSize.max,
  174. crossAxisAlignment: CrossAxisAlignment.center,
  175. children: [
  176. MyTextView(
  177. "Work Out:".tr,
  178. isFontRegular: true,
  179. textColor: ColorConstants.textGrayAECAE5,
  180. fontSize: 14,
  181. ),
  182. //时间
  183. MyTextView(
  184. item.workOut?.time ?? "-",
  185. marginLeft: 5,
  186. isFontRegular: true,
  187. textColor: item.workOut?.changed == 1 ? ColorConstants.textRedFF6262 : Colors.white,
  188. fontSize: 14,
  189. ).expanded(),
  190. ],
  191. ).marginOnly(top: 12),
  192. // 门卫签出时间
  193. Row(
  194. mainAxisSize: MainAxisSize.max,
  195. crossAxisAlignment: CrossAxisAlignment.center,
  196. children: [
  197. MyTextView(
  198. "Security Out:".tr,
  199. isFontRegular: true,
  200. textColor: ColorConstants.textGrayAECAE5,
  201. fontSize: 14,
  202. ),
  203. //时间
  204. MyTextView(
  205. item.securityOut?.time ?? "-",
  206. marginLeft: 5,
  207. isFontRegular: true,
  208. textColor: item.securityOut?.changed == 1 ? ColorConstants.textRedFF6262 : Colors.white,
  209. fontSize: 14,
  210. ).expanded(),
  211. ],
  212. ).marginOnly(top: 12),
  213. // + - Hours
  214. Visibility(
  215. visible: jobInfo?.jobUnit == "hour",
  216. child: Row(
  217. mainAxisSize: MainAxisSize.max,
  218. crossAxisAlignment: CrossAxisAlignment.center,
  219. children: [
  220. MyTextView(
  221. "+/- Hours:".tr,
  222. isFontRegular: true,
  223. textColor: ColorConstants.textGrayAECAE5,
  224. fontSize: 14,
  225. ),
  226. //小时
  227. MyTextView(
  228. Utils.isNotEmpty(item.adjustShow) ? item.adjustShow! : "0",
  229. marginLeft: 5,
  230. isFontRegular: true,
  231. textColor: Colors.white,
  232. fontSize: 14,
  233. ).expanded(),
  234. ],
  235. ).marginOnly(top: 12),
  236. ),
  237. // Total Hours
  238. Visibility(
  239. visible: jobInfo?.jobUnit == "hour",
  240. child: Row(
  241. mainAxisSize: MainAxisSize.max,
  242. crossAxisAlignment: CrossAxisAlignment.center,
  243. children: [
  244. MyTextView(
  245. "Total Hours:".tr,
  246. isFontRegular: true,
  247. textColor: ColorConstants.textGrayAECAE5,
  248. fontSize: 14,
  249. ),
  250. //小时
  251. MyTextView(
  252. item.totalShow.toString(),
  253. marginLeft: 5,
  254. isFontRegular: true,
  255. textColor: Colors.white,
  256. fontSize: 14,
  257. ).expanded(),
  258. ],
  259. ).marginOnly(top: 12),
  260. ),
  261. // Total Rooms
  262. Visibility(
  263. visible: jobInfo?.jobUnit != "hour",
  264. child: Row(
  265. mainAxisSize: MainAxisSize.max,
  266. crossAxisAlignment: CrossAxisAlignment.center,
  267. children: [
  268. MyTextView(
  269. "Total Rooms:".tr,
  270. isFontRegular: true,
  271. textColor: ColorConstants.textGrayAECAE5,
  272. fontSize: 14,
  273. ),
  274. //小时
  275. MyTextView(
  276. item.totalRooms.toString(),
  277. marginLeft: 5,
  278. isFontRegular: true,
  279. textColor: Colors.white,
  280. fontSize: 14,
  281. ).expanded(),
  282. ],
  283. ).marginOnly(top: 12),
  284. ),
  285. // 申请时间
  286. Row(
  287. mainAxisSize: MainAxisSize.max,
  288. crossAxisAlignment: CrossAxisAlignment.center,
  289. children: [
  290. MyTextView(
  291. "Applied At:".tr,
  292. isFontRegular: true,
  293. textColor: ColorConstants.textGrayAECAE5,
  294. fontSize: 14,
  295. ),
  296. //发布状态
  297. MyTextView(
  298. item.appliedAt ?? "-",
  299. marginLeft: 5,
  300. isFontRegular: true,
  301. textColor: Colors.white,
  302. fontSize: 14,
  303. ).expanded(),
  304. ],
  305. ).marginOnly(top: 12),
  306. // 状态
  307. Row(
  308. mainAxisSize: MainAxisSize.max,
  309. crossAxisAlignment: CrossAxisAlignment.center,
  310. children: [
  311. MyTextView(
  312. "Status:".tr,
  313. isFontRegular: true,
  314. textColor: ColorConstants.textGrayAECAE5,
  315. fontSize: 14,
  316. ),
  317. //发布状态
  318. MyTextView(
  319. item.statusShow ?? "-",
  320. marginLeft: 5,
  321. isFontRegular: true,
  322. textColor: "Completed" == item.statusShow
  323. ? ColorConstants.textGreen05DC82
  324. : "Cancelled" == item.statusShow || "Rejected" == item.statusShow
  325. ? ColorConstants.textRedFF6262
  326. : "Revised" == item.statusShow || "Pending" == item.statusShow || "Approve" == item.statusShow
  327. ? ColorConstants.textYellowFFBB1B
  328. : ColorConstants.textBlue06D9FF, //默认蓝色
  329. fontSize: 14,
  330. ).expanded(),
  331. ],
  332. ).marginOnly(top: 12),
  333. //按钮组
  334. Visibility(
  335. visible: item.actionList?.isNotEmpty ?? false,
  336. child: Row(
  337. mainAxisSize: MainAxisSize.max,
  338. mainAxisAlignment: MainAxisAlignment.end,
  339. crossAxisAlignment: CrossAxisAlignment.center,
  340. children: [
  341. //编辑按钮
  342. Visibility(
  343. visible: item.actionList?.contains("edit") ?? false,
  344. child: MyButton(
  345. onPressed: () {
  346. FocusScope.of(context).unfocus();
  347. onEditAction?.call();
  348. },
  349. text: "Edit".tr,
  350. textColor: ColorConstants.white,
  351. backgroundColor: hexToColor(
  352. "#FFBB1B",
  353. ),
  354. radius: 17.25,
  355. minWidth: 60,
  356. minHeight: 35,
  357. ).marginOnly(left: 12),
  358. ),
  359. //状态工作流按钮
  360. Visibility(
  361. visible: item.actionList?.contains("status") ?? false,
  362. child: MyButton(
  363. onPressed: () {
  364. FocusScope.of(context).unfocus();
  365. onStatusAction?.call();
  366. },
  367. text: "Status".tr,
  368. textColor: ColorConstants.white,
  369. backgroundColor: hexToColor("#0AC074"),
  370. radius: 17.25,
  371. minWidth: 60,
  372. minHeight: 35,
  373. ).marginOnly(left: 12),
  374. ),
  375. //Remark按钮
  376. Visibility(
  377. visible: item.actionList?.contains("remarks") ?? false,
  378. child: MyButton(
  379. onPressed: () {
  380. FocusScope.of(context).unfocus();
  381. onRemarkAction?.call();
  382. },
  383. text: "Remarks".tr,
  384. textColor: ColorConstants.white,
  385. backgroundColor: hexToColor("#56AAFF"),
  386. radius: 17.25,
  387. minWidth: 60,
  388. minHeight: 35,
  389. ).marginOnly(left: 12),
  390. ),
  391. ],
  392. ).marginOnly(top: 15),
  393. ),
  394. ],
  395. ).onTap(() {
  396. onItemAction?.call();
  397. }),
  398. );
  399. }
  400. }