web: migrate health notifications to js_interop; add browser hook
- Replace dart:js with package:js in health_check_service_web.dart\n- Implement showHealthCheckNotification in web/index.html\n- Pin js dependency to ^0.6.7 for flutter_secure_storage_web compatibility auth: harden AuthInterceptor + tests - Allow overrideAuthRepository injection for testing\n- Normalize imports to package: paths\n- Add unit test covering token attach, 401→refresh→retry, and failure path\n- Add integration test skeleton gated by env vars ui/data: map User.companyName to list column - Add companyName to domain User\n- Map UserDto.company?.name\n- Render companyName in user_list cleanup: remove legacy equipment table + unused code; minor warnings - Remove _buildFlexibleTable and unused helpers\n- Remove unused zipcode details and cache retry constant\n- Fix null-aware and non-null assertions\n- Address child-last warnings in administrator dialog docs: update AGENTS.md session context
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:superport/screens/user/controllers/user_form_controller.dart';
|
||||
import 'package:superport/utils/formatters/korean_phone_formatter.dart';
|
||||
import 'package:superport/screens/common/widgets/standard_dropdown.dart';
|
||||
import 'package:superport/screens/common/templates/form_layout_template.dart';
|
||||
|
||||
// 사용자 등록/수정 화면 (UI만 담당, 상태/로직 분리)
|
||||
class UserFormScreen extends StatefulWidget {
|
||||
@@ -39,17 +40,37 @@ class _UserFormScreenState extends State<UserFormScreen> {
|
||||
},
|
||||
child: Consumer<UserFormController>(
|
||||
builder: (context, controller, child) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(controller.isEditMode ? '사용자 수정' : '사용자 등록'),
|
||||
),
|
||||
body: controller.isLoading
|
||||
// Phase 10: FormLayoutTemplate 적용
|
||||
return FormLayoutTemplate(
|
||||
title: controller.isEditMode ? '사용자 수정' : '사용자 등록',
|
||||
isLoading: controller.isLoading,
|
||||
onSave: () async {
|
||||
// 폼 검증
|
||||
if (!controller.formKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
controller.formKey.currentState!.save();
|
||||
|
||||
// 사용자 저장
|
||||
bool success = false;
|
||||
await controller.saveUser((error) {
|
||||
if (error == null) {
|
||||
success = true;
|
||||
} else {
|
||||
// 에러 처리는 controller에서 관리
|
||||
}
|
||||
});
|
||||
|
||||
if (success && mounted) {
|
||||
Navigator.of(context).pop(true);
|
||||
}
|
||||
},
|
||||
onCancel: () => Navigator.of(context).pop(),
|
||||
child: controller.isLoading
|
||||
? const Center(child: ShadProgress())
|
||||
: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Form(
|
||||
key: controller.formKey,
|
||||
child: SingleChildScrollView(
|
||||
: Form(
|
||||
key: controller.formKey,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -85,32 +106,35 @@ class _UserFormScreenState extends State<UserFormScreen> {
|
||||
// 회사 선택 (*필수)
|
||||
_buildCompanyDropdown(controller),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 중복 검사 상태 메시지 영역 (고정 높이)
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: Center(
|
||||
child: controller.isCheckingEmailDuplicate
|
||||
? const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ShadProgress(),
|
||||
SizedBox(width: 8),
|
||||
Text('중복 검사 중...'),
|
||||
],
|
||||
)
|
||||
: controller.emailDuplicateMessage != null
|
||||
? Text(
|
||||
controller.emailDuplicateMessage!,
|
||||
style: const TextStyle(
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
// 중복 검사 상태 메시지 영역
|
||||
if (controller.isCheckingEmailDuplicate)
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ShadProgress(),
|
||||
SizedBox(width: 8),
|
||||
Text('중복 검사 중...'),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
if (controller.emailDuplicateMessage != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: Center(
|
||||
child: Text(
|
||||
controller.emailDuplicateMessage!,
|
||||
style: const TextStyle(
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 오류 메시지 표시
|
||||
if (controller.error != null)
|
||||
@@ -121,22 +145,10 @@ class _UserFormScreenState extends State<UserFormScreen> {
|
||||
description: Text(controller.error!),
|
||||
),
|
||||
),
|
||||
// 저장 버튼
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ShadButton(
|
||||
onPressed: controller.isLoading || controller.isCheckingEmailDuplicate
|
||||
? null
|
||||
: () => _onSaveUser(controller),
|
||||
size: ShadButtonSize.lg,
|
||||
child: Text(controller.isEditMode ? '수정하기' : '등록하기'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -153,7 +165,6 @@ class _UserFormScreenState extends State<UserFormScreen> {
|
||||
String? Function(String?)? validator,
|
||||
void Function(String?)? onSaved,
|
||||
void Function(String)? onChanged,
|
||||
Widget? suffixIcon,
|
||||
}) {
|
||||
final controller = TextEditingController(text: initialValue.isNotEmpty ? initialValue : '');
|
||||
return Padding(
|
||||
@@ -247,45 +258,4 @@ class _UserFormScreenState extends State<UserFormScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// 저장 버튼 클릭 시 사용자 저장
|
||||
void _onSaveUser(UserFormController controller) async {
|
||||
// 먼저 폼 유효성 검사
|
||||
if (controller.formKey.currentState?.validate() != true) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 폼 데이터 저장
|
||||
controller.formKey.currentState?.save();
|
||||
|
||||
// 이메일 중복 검사 (저장 시점)
|
||||
final emailIsUnique = await controller.checkDuplicateEmail(controller.email);
|
||||
|
||||
if (!emailIsUnique) {
|
||||
// 중복이 발견되면 저장하지 않음
|
||||
return;
|
||||
}
|
||||
|
||||
// 이메일 중복이 없으면 저장 진행
|
||||
await controller.saveUser((error) {
|
||||
if (error != null) {
|
||||
ShadToaster.of(context).show(
|
||||
ShadToast.destructive(
|
||||
title: const Text('오류'),
|
||||
description: Text(error),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
ShadToaster.of(context).show(
|
||||
ShadToast(
|
||||
title: const Text('성공'),
|
||||
description: Text(
|
||||
controller.isEditMode ? '사용자 정보가 수정되었습니다' : '사용자가 등록되었습니다',
|
||||
),
|
||||
),
|
||||
);
|
||||
Navigator.pop(context, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user