applied_staff_item.dart 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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. MyAssetImage(
  75. item.isSelected ? Assets.baseServiceItemSelectedIcon : Assets.baseServiceItemUnselectedIcon,
  76. width: 20.5,
  77. height: 20.5,
  78. ),
  79. ],
  80. ),
  81. // 工作开始时间
  82. Row(
  83. mainAxisSize: MainAxisSize.max,
  84. crossAxisAlignment: CrossAxisAlignment.center,
  85. children: [
  86. MyTextView(
  87. "Start Time:".tr,
  88. isFontRegular: true,
  89. textColor: ColorConstants.textGrayAECAE5,
  90. fontSize: 14,
  91. ),
  92. //时间
  93. MyTextView(
  94. item.startTime ?? "-",
  95. marginLeft: 5,
  96. isFontRegular: true,
  97. textColor: Colors.white,
  98. fontSize: 14,
  99. ).expanded(),
  100. ],
  101. ).marginOnly(top: 12),
  102. // 门卫签到时间
  103. Row(
  104. mainAxisSize: MainAxisSize.max,
  105. crossAxisAlignment: CrossAxisAlignment.center,
  106. children: [
  107. MyTextView(
  108. "Security In:".tr,
  109. isFontRegular: true,
  110. textColor: ColorConstants.textGrayAECAE5,
  111. fontSize: 14,
  112. ),
  113. //时间
  114. MyTextView(
  115. item.securityIn?.time ?? "-",
  116. marginLeft: 5,
  117. isFontRegular: true,
  118. textColor: item.securityIn?.changed == 1 ? ColorConstants.textRedFF6262 : Colors.white,
  119. fontSize: 14,
  120. ).expanded(),
  121. ],
  122. ).marginOnly(top: 12),
  123. // 工作地签到时间
  124. Row(
  125. mainAxisSize: MainAxisSize.max,
  126. crossAxisAlignment: CrossAxisAlignment.center,
  127. children: [
  128. MyTextView(
  129. "Work In:".tr,
  130. isFontRegular: true,
  131. textColor: ColorConstants.textGrayAECAE5,
  132. fontSize: 14,
  133. ),
  134. //时间
  135. MyTextView(
  136. item.workIn?.time ?? "-",
  137. marginLeft: 5,
  138. isFontRegular: true,
  139. textColor: item.workIn?.changed == 1 ? ColorConstants.textRedFF6262 : Colors.white,
  140. fontSize: 14,
  141. ).expanded(),
  142. ],
  143. ).marginOnly(top: 12),
  144. //工作结束时间
  145. Row(
  146. mainAxisSize: MainAxisSize.max,
  147. crossAxisAlignment: CrossAxisAlignment.center,
  148. children: [
  149. MyTextView(
  150. "End Time:".tr,
  151. isFontRegular: true,
  152. textColor: ColorConstants.textGrayAECAE5,
  153. fontSize: 14,
  154. ),
  155. //时间
  156. MyTextView(
  157. item.endTime ?? "-",
  158. marginLeft: 5,
  159. isFontRegular: true,
  160. textColor: Colors.white,
  161. fontSize: 14,
  162. ).expanded(),
  163. ],
  164. ).marginOnly(top: 12),
  165. // 工作地签出时间
  166. Row(
  167. mainAxisSize: MainAxisSize.max,
  168. crossAxisAlignment: CrossAxisAlignment.center,
  169. children: [
  170. MyTextView(
  171. "Work Out:".tr,
  172. isFontRegular: true,
  173. textColor: ColorConstants.textGrayAECAE5,
  174. fontSize: 14,
  175. ),
  176. //时间
  177. MyTextView(
  178. item.workOut?.time ?? "-",
  179. marginLeft: 5,
  180. isFontRegular: true,
  181. textColor: item.workOut?.changed == 1 ? ColorConstants.textRedFF6262 : Colors.white,
  182. fontSize: 14,
  183. ).expanded(),
  184. ],
  185. ).marginOnly(top: 12),
  186. // 门卫签出时间
  187. Row(
  188. mainAxisSize: MainAxisSize.max,
  189. crossAxisAlignment: CrossAxisAlignment.center,
  190. children: [
  191. MyTextView(
  192. "Security Out:".tr,
  193. isFontRegular: true,
  194. textColor: ColorConstants.textGrayAECAE5,
  195. fontSize: 14,
  196. ),
  197. //时间
  198. MyTextView(
  199. item.securityOut?.time ?? "-",
  200. marginLeft: 5,
  201. isFontRegular: true,
  202. textColor: item.securityOut?.changed == 1 ? ColorConstants.textRedFF6262 : Colors.white,
  203. fontSize: 14,
  204. ).expanded(),
  205. ],
  206. ).marginOnly(top: 12),
  207. // + - Hours
  208. Visibility(
  209. visible: jobInfo?.jobUnit == "hour",
  210. child: Row(
  211. mainAxisSize: MainAxisSize.max,
  212. crossAxisAlignment: CrossAxisAlignment.center,
  213. children: [
  214. MyTextView(
  215. "+/- Hours:".tr,
  216. isFontRegular: true,
  217. textColor: ColorConstants.textGrayAECAE5,
  218. fontSize: 14,
  219. ),
  220. //小时
  221. MyTextView(
  222. Utils.isNotEmpty(item.adjustShow) ? item.adjustShow! : "0",
  223. marginLeft: 5,
  224. isFontRegular: true,
  225. textColor: Colors.white,
  226. fontSize: 14,
  227. ).expanded(),
  228. ],
  229. ).marginOnly(top: 12),
  230. ),
  231. // Total Hours
  232. Visibility(
  233. visible: jobInfo?.jobUnit == "hour",
  234. child: Row(
  235. mainAxisSize: MainAxisSize.max,
  236. crossAxisAlignment: CrossAxisAlignment.center,
  237. children: [
  238. MyTextView(
  239. "Total Hours:".tr,
  240. isFontRegular: true,
  241. textColor: ColorConstants.textGrayAECAE5,
  242. fontSize: 14,
  243. ),
  244. //小时
  245. MyTextView(
  246. item.totalShow.toString(),
  247. marginLeft: 5,
  248. isFontRegular: true,
  249. textColor: Colors.white,
  250. fontSize: 14,
  251. ).expanded(),
  252. ],
  253. ).marginOnly(top: 12),
  254. ),
  255. // Total Rooms
  256. Visibility(
  257. visible: jobInfo?.jobUnit != "hour",
  258. child: Row(
  259. mainAxisSize: MainAxisSize.max,
  260. crossAxisAlignment: CrossAxisAlignment.center,
  261. children: [
  262. MyTextView(
  263. "Total Rooms:".tr,
  264. isFontRegular: true,
  265. textColor: ColorConstants.textGrayAECAE5,
  266. fontSize: 14,
  267. ),
  268. //小时
  269. MyTextView(
  270. item.totalRooms.toString(),
  271. marginLeft: 5,
  272. isFontRegular: true,
  273. textColor: Colors.white,
  274. fontSize: 14,
  275. ).expanded(),
  276. ],
  277. ).marginOnly(top: 12),
  278. ),
  279. // 申请时间
  280. Row(
  281. mainAxisSize: MainAxisSize.max,
  282. crossAxisAlignment: CrossAxisAlignment.center,
  283. children: [
  284. MyTextView(
  285. "Applied At:".tr,
  286. isFontRegular: true,
  287. textColor: ColorConstants.textGrayAECAE5,
  288. fontSize: 14,
  289. ),
  290. //发布状态
  291. MyTextView(
  292. item.appliedAt ?? "-",
  293. marginLeft: 5,
  294. isFontRegular: true,
  295. textColor: Colors.white,
  296. fontSize: 14,
  297. ).expanded(),
  298. ],
  299. ).marginOnly(top: 12),
  300. // 状态
  301. Row(
  302. mainAxisSize: MainAxisSize.max,
  303. crossAxisAlignment: CrossAxisAlignment.center,
  304. children: [
  305. MyTextView(
  306. "Status:".tr,
  307. isFontRegular: true,
  308. textColor: ColorConstants.textGrayAECAE5,
  309. fontSize: 14,
  310. ),
  311. //发布状态
  312. MyTextView(
  313. item.statusShow ?? "-",
  314. marginLeft: 5,
  315. isFontRegular: true,
  316. textColor: Colors.white,
  317. fontSize: 14,
  318. ).expanded(),
  319. ],
  320. ).marginOnly(top: 12),
  321. //按钮组
  322. Visibility(
  323. visible: item.actionList?.isNotEmpty ?? false,
  324. child: Row(
  325. mainAxisSize: MainAxisSize.max,
  326. mainAxisAlignment: MainAxisAlignment.end,
  327. crossAxisAlignment: CrossAxisAlignment.center,
  328. children: [
  329. //编辑按钮
  330. Visibility(
  331. visible: item.actionList?.contains("edit") ?? false,
  332. child: MyButton(
  333. onPressed: () {
  334. FocusScope.of(context).unfocus();
  335. onEditAction?.call();
  336. },
  337. text: "Edit".tr,
  338. textColor: ColorConstants.white,
  339. backgroundColor: hexToColor(
  340. "#FFBB1B",
  341. ),
  342. radius: 17.25,
  343. minWidth: 60,
  344. minHeight: 35,
  345. ).marginOnly(left: 12),
  346. ),
  347. //状态工作流按钮
  348. Visibility(
  349. visible: item.actionList?.contains("status") ?? false,
  350. child: MyButton(
  351. onPressed: () {
  352. FocusScope.of(context).unfocus();
  353. onStatusAction?.call();
  354. },
  355. text: "Status".tr,
  356. textColor: ColorConstants.white,
  357. backgroundColor: hexToColor("#0AC074"),
  358. radius: 17.25,
  359. minWidth: 60,
  360. minHeight: 35,
  361. ).marginOnly(left: 12),
  362. ),
  363. //Remark按钮
  364. Visibility(
  365. visible: item.actionList?.contains("remarks") ?? false,
  366. child: MyButton(
  367. onPressed: () {
  368. FocusScope.of(context).unfocus();
  369. onRemarkAction?.call();
  370. },
  371. text: "Remarks".tr,
  372. textColor: ColorConstants.white,
  373. backgroundColor: hexToColor("#56AAFF"),
  374. radius: 17.25,
  375. minWidth: 60,
  376. minHeight: 35,
  377. ).marginOnly(left: 12),
  378. ),
  379. ],
  380. ).marginOnly(top: 15),
  381. ),
  382. ],
  383. ).onTap(() {
  384. onItemAction?.call();
  385. }),
  386. );
  387. }
  388. }