2023-07-11 18:37:25 +08:00
|
|
|
import 'package:flutter/material.dart';
|
2024-01-19 11:09:46 +08:00
|
|
|
import 'package:flutter/services.dart';
|
2023-07-11 18:37:25 +08:00
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
import 'package:star_lock/app_settings/app_colors.dart';
|
2024-05-29 09:06:26 +08:00
|
|
|
import 'package:star_lock/app_settings/app_settings.dart';
|
2024-05-20 11:59:34 +08:00
|
|
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInSet/checkingInSet_state.dart';
|
2023-07-11 18:37:25 +08:00
|
|
|
|
|
|
|
|
import '../../../../appRouters.dart';
|
|
|
|
|
import '../../../../tools/commonItem.dart';
|
|
|
|
|
import '../../../../tools/showTFView.dart';
|
2024-04-07 14:03:59 +08:00
|
|
|
import '../../../../tools/showTipView.dart';
|
2023-07-11 18:37:25 +08:00
|
|
|
import '../../../../tools/submitBtn.dart';
|
|
|
|
|
import '../../../../tools/titleAppBar.dart';
|
2023-09-09 18:33:37 +08:00
|
|
|
import 'checkingInSet_logic.dart';
|
2023-07-11 18:37:25 +08:00
|
|
|
|
|
|
|
|
class CheckingInSetPage extends StatefulWidget {
|
2023-07-15 15:11:28 +08:00
|
|
|
const CheckingInSetPage({Key? key}) : super(key: key);
|
2023-07-11 18:37:25 +08:00
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<CheckingInSetPage> createState() => _CheckingInSetPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
2024-05-20 11:59:34 +08:00
|
|
|
final CheckingInSetLogic logic = Get.put(CheckingInSetLogic());
|
|
|
|
|
final CheckingInSetState state = Get.find<CheckingInSetLogic>().state;
|
2023-09-09 18:33:37 +08:00
|
|
|
|
2023-07-11 18:37:25 +08:00
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
2023-07-27 15:26:30 +08:00
|
|
|
appBar: TitleAppBar(
|
2024-07-25 14:40:02 +08:00
|
|
|
barTitle: '考勤设置'.tr,
|
2023-07-27 15:26:30 +08:00
|
|
|
haveBack: true,
|
|
|
|
|
backgroundColor: AppColors.mainColor),
|
2023-07-11 18:37:25 +08:00
|
|
|
body: Column(
|
2024-05-20 11:59:34 +08:00
|
|
|
children: <Widget>[
|
2023-09-15 16:04:11 +08:00
|
|
|
Obx(() => CommonItem(
|
2024-11-06 09:28:18 +08:00
|
|
|
leftTitel: '公司名称'.tr,
|
2024-05-20 11:59:34 +08:00
|
|
|
rightTitle: state.companyName.value ?? '',
|
|
|
|
|
// isHaveRightWidget: true,
|
|
|
|
|
// rightWidget: getTFWidget(),
|
2023-07-27 15:26:30 +08:00
|
|
|
isHaveLine: true,
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
action: () {
|
|
|
|
|
showCupertinoAlertDialog(context);
|
2023-09-15 16:04:11 +08:00
|
|
|
})),
|
|
|
|
|
Obx(() => CommonItem(
|
2024-07-29 19:30:29 +08:00
|
|
|
leftTitel: '员工'.tr,
|
2023-09-15 16:04:11 +08:00
|
|
|
rightTitle: state.staffNumber.value,
|
2023-07-27 15:26:30 +08:00
|
|
|
isHaveLine: true,
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
action: () {
|
2024-11-06 09:28:18 +08:00
|
|
|
Get.toNamed(Routers.checkingInStaffManagePage,
|
|
|
|
|
arguments: <String, Object>{
|
|
|
|
|
'getKeyInfosData': state.getKeyInfosData.value,
|
|
|
|
|
'companyId': state.companyId.value
|
|
|
|
|
});
|
2023-09-15 16:04:11 +08:00
|
|
|
})),
|
|
|
|
|
Obx(() => CommonItem(
|
2024-07-26 14:12:26 +08:00
|
|
|
leftTitel: '工作时间'.tr,
|
2024-11-06 09:28:18 +08:00
|
|
|
rightTitle: (state.beginTime.value.isNotEmpty)
|
|
|
|
|
? '${state.beginTime.value} - ${state.endTime.value}'
|
|
|
|
|
: '',
|
2023-07-27 15:26:30 +08:00
|
|
|
isHaveLine: true,
|
|
|
|
|
isHaveDirection: true,
|
2023-09-15 16:04:11 +08:00
|
|
|
action: () async {
|
2024-11-06 09:28:18 +08:00
|
|
|
var data = await Get.toNamed(Routers.checkingInSetWorkTimePage,
|
|
|
|
|
arguments: <String, Object>{
|
|
|
|
|
// "getKeyInfosData": state.getKeyInfosData.value,
|
|
|
|
|
'companyId': state.companyId.value,
|
|
|
|
|
'pushType': '2',
|
|
|
|
|
'checkingInSetInfo': state.checkingInSetInfo.value,
|
|
|
|
|
});
|
|
|
|
|
if (data != null) {
|
2024-05-21 17:56:50 +08:00
|
|
|
setState(logic.getCheckInSetInfoData);
|
2023-09-15 16:04:11 +08:00
|
|
|
}
|
|
|
|
|
})),
|
|
|
|
|
Obx(() => CommonItem(
|
2024-07-29 19:30:29 +08:00
|
|
|
leftTitel: '工作日设置'.tr,
|
2024-11-06 09:28:18 +08:00
|
|
|
rightTitle: state.isCustom.value == true
|
|
|
|
|
? state.weekDaysStr.value
|
|
|
|
|
: (state.weekDays.value.length == 6 ? '单休'.tr : '双休'.tr),
|
2023-07-27 15:26:30 +08:00
|
|
|
isHaveLine: true,
|
|
|
|
|
isHaveDirection: true,
|
2023-09-15 16:04:11 +08:00
|
|
|
action: () async {
|
2024-11-06 09:28:18 +08:00
|
|
|
var data = await Get.toNamed(Routers.checkingInSetWorkdaySet,
|
|
|
|
|
arguments: <String, Object>{
|
|
|
|
|
'getKeyInfosData': state.getKeyInfosData.value,
|
|
|
|
|
'companyId': state.companyId.value,
|
|
|
|
|
'pushType': '2',
|
|
|
|
|
'checkingInSetInfo': state.checkingInSetInfo.value,
|
|
|
|
|
});
|
|
|
|
|
if (data != null) {
|
2024-05-20 11:59:34 +08:00
|
|
|
state.isCustom.value = data['attendanceType'];
|
|
|
|
|
state.weekDays.value = data['weekDays'];
|
2024-05-21 17:56:50 +08:00
|
|
|
state.weekDaysStr.value = state.weekDays.join(',');
|
2024-11-06 09:28:18 +08:00
|
|
|
AppLog.log(
|
|
|
|
|
'state.weekDays.value:${state.weekDays.value} state.weekDaysStr.value:${state.weekDaysStr.value}');
|
2024-05-29 09:06:26 +08:00
|
|
|
setState(() {});
|
2023-09-15 16:04:11 +08:00
|
|
|
}
|
|
|
|
|
})),
|
2023-07-27 15:26:30 +08:00
|
|
|
CommonItem(
|
2024-07-29 19:30:29 +08:00
|
|
|
leftTitel: '节假日'.tr,
|
2024-05-20 11:59:34 +08:00
|
|
|
rightTitle: '',
|
2023-07-27 15:26:30 +08:00
|
|
|
isHaveLine: false,
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
action: () {
|
2024-11-06 09:28:18 +08:00
|
|
|
Get.toNamed(Routers.checkingInSetHolidaysPage,
|
|
|
|
|
arguments: <String, String>{
|
|
|
|
|
'companyId': state.companyId.value
|
|
|
|
|
});
|
2023-07-27 15:26:30 +08:00
|
|
|
}),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 30.h,
|
|
|
|
|
),
|
2024-01-29 17:23:45 +08:00
|
|
|
Visibility(
|
|
|
|
|
visible: state.getKeyInfosData.value.isLockOwner == 1,
|
|
|
|
|
child: SubmitBtn(
|
2024-07-26 09:21:22 +08:00
|
|
|
btnName: '删除公司'.tr,
|
2024-01-29 17:23:45 +08:00
|
|
|
borderRadius: 20.w,
|
|
|
|
|
fontSize: 32.sp,
|
|
|
|
|
isDelete: true,
|
|
|
|
|
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
|
|
|
|
|
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
|
|
|
|
onClick: () {
|
2024-11-06 09:28:18 +08:00
|
|
|
ShowTipView().showIosTipWithContentDialog(
|
|
|
|
|
'是否删除?'.tr, logic.deletCompanyData);
|
2024-04-07 14:03:59 +08:00
|
|
|
// showDeletCompanyAlertDialog(context);
|
2024-01-29 17:23:45 +08:00
|
|
|
}),
|
|
|
|
|
),
|
2023-07-11 18:37:25 +08:00
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void showCupertinoAlertDialog(BuildContext context) {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
2023-07-27 15:26:30 +08:00
|
|
|
return ShowTFView(
|
2024-08-27 11:08:44 +08:00
|
|
|
title: '修改名字'.tr,
|
2024-05-20 11:59:34 +08:00
|
|
|
tipTitle: '',
|
2023-09-15 16:04:11 +08:00
|
|
|
controller: state.changeNameController,
|
2024-05-20 11:59:34 +08:00
|
|
|
inputFormatters: <TextInputFormatter>[
|
2024-11-06 09:28:18 +08:00
|
|
|
LengthLimitingTextInputFormatter(30),
|
2024-05-20 11:59:34 +08:00
|
|
|
],
|
2023-09-09 18:33:37 +08:00
|
|
|
sureClick: () {
|
2024-11-06 09:28:18 +08:00
|
|
|
if (state.changeNameController.text.isEmpty) {
|
2024-05-20 11:59:34 +08:00
|
|
|
logic.showToast('请输入公司名字'.tr);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-11-06 09:28:18 +08:00
|
|
|
if (state.changeNameController.text.length < 6) {
|
2024-05-20 11:59:34 +08:00
|
|
|
logic.showToast('公司名字长度不能小于 6 '.tr);
|
2023-09-15 16:04:11 +08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Get.back();
|
|
|
|
|
logic.editCheckInSetInfoData();
|
2023-09-09 18:33:37 +08:00
|
|
|
},
|
|
|
|
|
cancelClick: () {
|
2023-09-15 16:04:11 +08:00
|
|
|
Get.back();
|
2024-11-06 09:28:18 +08:00
|
|
|
},
|
|
|
|
|
);
|
2023-07-11 18:37:25 +08:00
|
|
|
});
|
|
|
|
|
}
|
2024-01-19 11:09:46 +08:00
|
|
|
|
|
|
|
|
// 接受者信息输入框
|
|
|
|
|
Widget getTFWidget() {
|
2024-05-20 11:59:34 +08:00
|
|
|
state.nameController.text = state.companyName.value ?? '';
|
2024-01-19 11:09:46 +08:00
|
|
|
return Container(
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
height: 65.h,
|
|
|
|
|
width: 300.w,
|
|
|
|
|
padding: EdgeInsets.only(top: 5.h),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
2024-05-20 11:59:34 +08:00
|
|
|
children: <Widget>[
|
2024-01-19 11:09:46 +08:00
|
|
|
Expanded(
|
|
|
|
|
child: TextField(
|
|
|
|
|
//输入框一行
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
inputFormatters: <TextInputFormatter>[
|
|
|
|
|
FilteringTextInputFormatter.deny('\n'),
|
|
|
|
|
LengthLimitingTextInputFormatter(30),
|
|
|
|
|
],
|
2024-11-06 09:28:18 +08:00
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
2024-01-19 11:09:46 +08:00
|
|
|
controller: state.nameController,
|
|
|
|
|
autofocus: false,
|
|
|
|
|
enabled: false,
|
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
//输入里面输入文字内边距设置
|
|
|
|
|
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
|
|
|
|
// hintText: state.companyName.value ?? "",
|
|
|
|
|
hintStyle: TextStyle(fontSize: 22.sp),
|
2024-11-06 09:28:18 +08:00
|
|
|
focusedBorder: const OutlineInputBorder(
|
|
|
|
|
borderSide:
|
|
|
|
|
BorderSide(width: 0, color: Colors.transparent)),
|
|
|
|
|
disabledBorder: const OutlineInputBorder(
|
|
|
|
|
borderSide:
|
|
|
|
|
BorderSide(width: 0, color: Colors.transparent)),
|
|
|
|
|
enabledBorder: const OutlineInputBorder(
|
|
|
|
|
borderSide:
|
|
|
|
|
BorderSide(width: 0, color: Colors.transparent)),
|
|
|
|
|
border: const OutlineInputBorder(
|
|
|
|
|
borderSide:
|
|
|
|
|
BorderSide(width: 0, color: Colors.transparent)),
|
2024-01-19 11:09:46 +08:00
|
|
|
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 10.w,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-07-11 18:37:25 +08:00
|
|
|
}
|