2023-11-03 13:58:41 +08:00

151 lines
5.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/tools/toast.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:
"${TranslationLoader.lanKeys!.company!.tr}${TranslationLoader.lanKeys!.name!.tr}",
rightTitle: state.companyName.value ?? "",
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) {
setState(() {
// state.isCustom.value = data["attendanceType"];
// state.weekDays.value = data["weekDays"];
// state.weekDaysStr.value = state.weekDays.value.join(",");
logic.getCheckInSetInfoData();
});
}
})),
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,
),
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: () {}),
],
),
);
}
void showCupertinoAlertDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return ShowTFView(
title: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.company!.tr}",
tipTitle: "",
controller: state.changeNameController,
sureClick: () {
if(state.changeNameController.text.isEmpty){
Toast.show(msg: "请输入公司姓名");
return;
}
Get.back();
logic.editCheckInSetInfoData();
},
cancelClick: () {
Get.back();
},);
});
}
}