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:
@@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import 'package:superport/models/user_model.dart';
|
||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||
import 'package:superport/screens/common/components/shadcn_components.dart';
|
||||
import 'package:superport/screens/common/layouts/base_list_screen.dart';
|
||||
import 'package:superport/screens/common/widgets/standard_action_bar.dart';
|
||||
import 'package:superport/screens/common/widgets/pagination.dart';
|
||||
@@ -55,24 +54,28 @@ class _UserListState extends State<UserList> {
|
||||
/// 사용자 권한 표시 배지
|
||||
Widget _buildUserRoleBadge(UserRole role) {
|
||||
final roleName = role.displayName;
|
||||
ShadcnBadgeVariant variant;
|
||||
Color backgroundColor;
|
||||
Color foregroundColor;
|
||||
|
||||
switch (role) {
|
||||
case UserRole.admin:
|
||||
variant = ShadcnBadgeVariant.destructive;
|
||||
backgroundColor = ShadcnTheme.alertCritical7.withValues(alpha: 0.1);
|
||||
foregroundColor = ShadcnTheme.alertCritical7;
|
||||
break;
|
||||
case UserRole.manager:
|
||||
variant = ShadcnBadgeVariant.primary;
|
||||
backgroundColor = ShadcnTheme.companyHeadquarters.withValues(alpha: 0.1);
|
||||
foregroundColor = ShadcnTheme.companyHeadquarters;
|
||||
break;
|
||||
case UserRole.staff:
|
||||
variant = ShadcnBadgeVariant.secondary;
|
||||
backgroundColor = ShadcnTheme.equipmentDisposal.withValues(alpha: 0.1);
|
||||
foregroundColor = ShadcnTheme.equipmentDisposal;
|
||||
break;
|
||||
}
|
||||
|
||||
return ShadcnBadge(
|
||||
text: roleName,
|
||||
variant: variant,
|
||||
size: ShadcnBadgeSize.small,
|
||||
return ShadBadge(
|
||||
backgroundColor: backgroundColor,
|
||||
foregroundColor: foregroundColor,
|
||||
child: Text(roleName),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -202,21 +205,21 @@ class _UserListState extends State<UserList> {
|
||||
'전체 사용자',
|
||||
_controller.total.toString(),
|
||||
Icons.people,
|
||||
ShadcnTheme.primary,
|
||||
ShadcnTheme.companyHeadquarters,
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing4),
|
||||
_buildStatCard(
|
||||
'활성 사용자',
|
||||
_controller.users.where((u) => u.isActive).length.toString(),
|
||||
Icons.check_circle,
|
||||
ShadcnTheme.success,
|
||||
ShadcnTheme.equipmentIn,
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing4),
|
||||
_buildStatCard(
|
||||
'비활성 사용자',
|
||||
_controller.users.where((u) => !u.isActive).length.toString(),
|
||||
Icons.person_off,
|
||||
ShadcnTheme.mutedForeground,
|
||||
ShadcnTheme.equipmentDisposal,
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -265,203 +268,92 @@ class _UserListState extends State<UserList> {
|
||||
Widget _buildDataTable() {
|
||||
final users = _controller.users;
|
||||
|
||||
if (users.isEmpty) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.people_outlined,
|
||||
size: 64,
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'등록된 사용자가 없습니다',
|
||||
style: ShadcnTheme.bodyMedium.copyWith(
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black),
|
||||
border: Border.all(color: ShadcnTheme.border),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// 고정 헤더
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||
border: Border(bottom: BorderSide(color: Colors.black)),
|
||||
),
|
||||
child: Row(children: _buildHeaderCells()),
|
||||
),
|
||||
// 스크롤 바디
|
||||
Expanded(
|
||||
child: users.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.people_outlined,
|
||||
size: 64,
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'등록된 사용자가 없습니다',
|
||||
style: ShadcnTheme.bodyMedium.copyWith(
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: users.length,
|
||||
itemBuilder: (context, index) => _buildTableRow(users[index], index),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: ShadTable.list(
|
||||
header: const [
|
||||
ShadTableCell.header(child: Text('번호')),
|
||||
ShadTableCell.header(child: Text('이름')),
|
||||
ShadTableCell.header(child: Text('이메일')),
|
||||
ShadTableCell.header(child: Text('회사')),
|
||||
ShadTableCell.header(child: Text('권한')),
|
||||
ShadTableCell.header(child: Text('상태')),
|
||||
ShadTableCell.header(child: Text('작업')),
|
||||
],
|
||||
children: [
|
||||
for (int index = 0; index < users.length; index++)
|
||||
[
|
||||
// 번호
|
||||
ShadTableCell(child: Text(((_controller.currentPage - 1) * _controller.pageSize + index + 1).toString(), style: ShadcnTheme.bodySmall)),
|
||||
// 이름
|
||||
ShadTableCell(child: Text(users[index].name, overflow: TextOverflow.ellipsis)),
|
||||
// 이메일
|
||||
ShadTableCell(child: Text(users[index].email ?? '-', overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall)),
|
||||
// 회사
|
||||
ShadTableCell(child: Text(users[index].companyName ?? '-', overflow: TextOverflow.ellipsis)),
|
||||
// 권한
|
||||
ShadTableCell(child: _buildUserRoleBadge(users[index].role)),
|
||||
// 상태
|
||||
ShadTableCell(child: _buildStatusChip(users[index].isActive)),
|
||||
// 작업
|
||||
ShadTableCell(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ShadButton.ghost(
|
||||
onPressed: users[index].id != null ? () => _navigateToEdit(users[index].id!) : null,
|
||||
child: const Icon(Icons.edit, size: 16),
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing1),
|
||||
ShadButton.ghost(
|
||||
onPressed: () => _showStatusChangeDialog(users[index]),
|
||||
child: Icon(users[index].isActive ? Icons.person_off : Icons.person, size: 16),
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing1),
|
||||
ShadButton.ghost(
|
||||
onPressed: users[index].id != null ? () => _showDeleteDialog(users[index].id!, users[index].name) : null,
|
||||
child: const Icon(Icons.delete, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _buildHeaderCells() {
|
||||
return [
|
||||
_buildHeaderCell('번호', flex: 0, useExpanded: false, minWidth: 50),
|
||||
_buildHeaderCell('이름', flex: 2, useExpanded: true, minWidth: 80),
|
||||
_buildHeaderCell('이메일', flex: 3, useExpanded: true, minWidth: 120),
|
||||
_buildHeaderCell('회사', flex: 2, useExpanded: true, minWidth: 80),
|
||||
_buildHeaderCell('권한', flex: 0, useExpanded: false, minWidth: 80),
|
||||
_buildHeaderCell('상태', flex: 0, useExpanded: false, minWidth: 80),
|
||||
_buildHeaderCell('작업', flex: 0, useExpanded: false, minWidth: 120),
|
||||
];
|
||||
}
|
||||
|
||||
Widget _buildHeaderCell(
|
||||
String text, {
|
||||
required int flex,
|
||||
required bool useExpanded,
|
||||
required double minWidth,
|
||||
}) {
|
||||
final child = Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
text,
|
||||
style: ShadcnTheme.bodyMedium.copyWith(fontWeight: FontWeight.w500),
|
||||
),
|
||||
);
|
||||
|
||||
if (useExpanded) {
|
||||
return Expanded(flex: flex, child: child);
|
||||
} else {
|
||||
return SizedBox(width: minWidth, child: child);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildDataCell(
|
||||
Widget child, {
|
||||
required int flex,
|
||||
required bool useExpanded,
|
||||
required double minWidth,
|
||||
}) {
|
||||
final container = Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: child,
|
||||
);
|
||||
|
||||
if (useExpanded) {
|
||||
return Expanded(flex: flex, child: container);
|
||||
} else {
|
||||
return SizedBox(width: minWidth, child: container);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildTableRow(User user, int index) {
|
||||
final rowNumber = (_controller.currentPage - 1) * _controller.pageSize + index + 1;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: index.isEven
|
||||
? ShadcnTheme.muted.withValues(alpha: 0.1)
|
||||
: null,
|
||||
border: const Border(
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
_buildDataCell(
|
||||
Text(
|
||||
rowNumber.toString(),
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 50,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
user.name,
|
||||
style: ShadcnTheme.bodyMedium.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
user.email ?? '',
|
||||
style: ShadcnTheme.bodyMedium,
|
||||
),
|
||||
flex: 3,
|
||||
useExpanded: true,
|
||||
minWidth: 120,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
'-', // Company name not available in current model
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildUserRoleBadge(user.role),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildStatusChip(user.isActive),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ShadButton.ghost(
|
||||
onPressed: user.id != null ? () => _navigateToEdit(user.id!) : null,
|
||||
child: const Icon(Icons.edit, size: 16),
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing1),
|
||||
ShadButton.ghost(
|
||||
onPressed: () => _showStatusChangeDialog(user),
|
||||
child: Icon(
|
||||
user.isActive ? Icons.person_off : Icons.person,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing1),
|
||||
ShadButton.ghost(
|
||||
onPressed: user.id != null ? () => _showDeleteDialog(user.id!, user.name) : null,
|
||||
child: const Icon(Icons.delete, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 120,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// (Deprecated) 기존 커스텀 테이블 빌더 유틸들은 ShadTable 전환으로 제거되었습니다.
|
||||
|
||||
Widget _buildPagination() {
|
||||
if (_controller.totalPages <= 1) return const SizedBox();
|
||||
|
||||
@@ -524,11 +416,15 @@ class _UserListState extends State<UserList> {
|
||||
|
||||
Widget _buildStatusChip(bool isActive) {
|
||||
if (isActive) {
|
||||
return ShadBadge.secondary(
|
||||
return ShadBadge(
|
||||
backgroundColor: ShadcnTheme.equipmentIn.withValues(alpha: 0.1),
|
||||
foregroundColor: ShadcnTheme.equipmentIn,
|
||||
child: const Text('활성'),
|
||||
);
|
||||
} else {
|
||||
return ShadBadge.destructive(
|
||||
return ShadBadge(
|
||||
backgroundColor: ShadcnTheme.equipmentDisposal.withValues(alpha: 0.1),
|
||||
foregroundColor: ShadcnTheme.equipmentDisposal,
|
||||
child: const Text('비활성'),
|
||||
);
|
||||
}
|
||||
@@ -536,4 +432,3 @@ class _UserListState extends State<UserList> {
|
||||
|
||||
// StandardDataRow 임시 정의
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user