applied_staff_item.dart 14 KB

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