232 lines
8.6 KiB
Dart
232 lines
8.6 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/app_settings/app_colors.dart';
|
|
|
|
import '../../../../appRouters.dart';
|
|
import '../../../../tools/commonItem.dart';
|
|
import '../../../../tools/showTFView.dart';
|
|
import '../../../../tools/submitBtn.dart';
|
|
import '../../../../tools/titleAppBar.dart';
|
|
import '../../../../translations/trans_lib.dart';
|
|
import 'checkingInSet_logic.dart';
|
|
|
|
class CheckingInSetPage extends StatefulWidget {
|
|
const CheckingInSetPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<CheckingInSetPage> createState() => _CheckingInSetPageState();
|
|
}
|
|
|
|
class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|
final logic = Get.put(CheckingInSetLogic());
|
|
final state = Get.find<CheckingInSetLogic>().state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
|
appBar: TitleAppBar(
|
|
barTitle:
|
|
"${TranslationLoader.lanKeys!.checkingIn!.tr}${TranslationLoader.lanKeys!.set!.tr}",
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor),
|
|
body: Column(
|
|
children: [
|
|
Obx(() => CommonItem(
|
|
leftTitel:
|
|
"公司名称",
|
|
// rightTitle: state.companyName.value ?? "",
|
|
isHaveRightWidget: true,
|
|
rightWidget: getTFWidget(),
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
showCupertinoAlertDialog(context);
|
|
})),
|
|
Obx(() => CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.staff!.tr,
|
|
rightTitle: state.staffNumber.value,
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Get.toNamed(Routers.checkingInStaffManagePage, arguments: {
|
|
"getKeyInfosData": state.getKeyInfosData.value,
|
|
"companyId": state.companyId.value
|
|
});
|
|
})),
|
|
Obx(() => CommonItem(
|
|
leftTitel:
|
|
"${TranslationLoader.lanKeys!.work!.tr}${TranslationLoader.lanKeys!.time!.tr}",
|
|
rightTitle: (state.beginTime.value.isNotEmpty) ? "${state.beginTime.value} - ${state.endTime.value}" : "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () async {
|
|
var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: {
|
|
// "getKeyInfosData": state.getKeyInfosData.value,
|
|
"companyId": state.companyId.value,
|
|
"pushType": "2",
|
|
"checkingInSetInfo": state.checkingInSetInfo.value,
|
|
});
|
|
if(data != null) {
|
|
setState(() {
|
|
// state.beginTime.value = data["beginTime"];
|
|
// state.endTime.value = data["endTime"];
|
|
// state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
|
|
// state.endTimeTimestamp.value = data["endTimeTimestamp"];
|
|
logic.getCheckInSetInfoData();
|
|
});
|
|
}
|
|
})),
|
|
Obx(() => CommonItem(
|
|
leftTitel:
|
|
"${TranslationLoader.lanKeys!.workday!.tr}${TranslationLoader.lanKeys!.set!.tr}",
|
|
rightTitle: state.weekDaysStr.value,
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () async {
|
|
var data = await Get.toNamed(Routers.checkingInSetWorkdaySet, arguments: {
|
|
"getKeyInfosData": state.getKeyInfosData.value,
|
|
"companyId": state.companyId.value,
|
|
"pushType": "2",
|
|
"checkingInSetInfo": state.checkingInSetInfo.value,
|
|
});
|
|
if(data != null) {
|
|
print("data: $data");
|
|
state.isCustom.value = data["attendanceType"];
|
|
state.weekDays.value = data["weekDays"];
|
|
state.weekDaysStr.value = state.weekDays.value.join(",");
|
|
// logic.getCheckInSetInfoData();
|
|
setState(() {});
|
|
}
|
|
})),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.holidays!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: false,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Get.toNamed(Routers.checkingInSetHolidaysPage, arguments: {
|
|
"companyId": state.companyId.value
|
|
});
|
|
}),
|
|
SizedBox(
|
|
height: 30.h,
|
|
),
|
|
Visibility(
|
|
visible: state.getKeyInfosData.value.isLockOwner == 1,
|
|
child: SubmitBtn(
|
|
btnName:
|
|
"${TranslationLoader.lanKeys!.delete!.tr}${TranslationLoader.lanKeys!.company!.tr}",
|
|
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: () {
|
|
showDeletCompanyAlertDialog(context);
|
|
}),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
void showCupertinoAlertDialog(BuildContext context) {
|
|
showDialog(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return ShowTFView(
|
|
title: "修改公司名字",
|
|
tipTitle: "",
|
|
controller: state.changeNameController,
|
|
sureClick: () {
|
|
if(state.changeNameController.text.isEmpty){
|
|
logic.showToast("请输入公司名字");
|
|
return;
|
|
}
|
|
Get.back();
|
|
logic.editCheckInSetInfoData();
|
|
},
|
|
cancelClick: () {
|
|
Get.back();
|
|
},);
|
|
});
|
|
}
|
|
|
|
// 接受者信息输入框
|
|
Widget getTFWidget() {
|
|
state.nameController.text = state.companyName.value ?? "";
|
|
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,
|
|
children: [
|
|
Expanded(
|
|
child: TextField(
|
|
//输入框一行
|
|
maxLines: 1,
|
|
inputFormatters: <TextInputFormatter>[
|
|
FilteringTextInputFormatter.deny('\n'),
|
|
LengthLimitingTextInputFormatter(30),
|
|
],
|
|
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
|
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),
|
|
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)),
|
|
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 10.w,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
void showDeletCompanyAlertDialog(context) {
|
|
showCupertinoDialog(
|
|
context: context,
|
|
builder: (context) {
|
|
return CupertinoAlertDialog(
|
|
title: const Text("提示"),
|
|
content: const Text('是否删除?'),
|
|
actions: [
|
|
CupertinoDialogAction(
|
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
|
onPressed: () {
|
|
Get.back();
|
|
},
|
|
),
|
|
CupertinoDialogAction(
|
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
|
onPressed: () {
|
|
Get.back();
|
|
logic.deletCompanyData();
|
|
},
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|