web: migrate health notifications to js_interop; add browser hook
Some checks failed
Flutter Test & Quality Check / Test on macos-latest (push) Has been cancelled
Flutter Test & Quality Check / Test on ubuntu-latest (push) Has been cancelled
Flutter Test & Quality Check / Build APK (push) Has been cancelled

- 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:
JiWoong Sul
2025-09-08 17:39:00 +09:00
parent 519e1883a3
commit 655d473413
55 changed files with 2729 additions and 4968 deletions

View File

@@ -192,25 +192,26 @@ class _MaintenanceAlertDashboardState extends State<MaintenanceAlertDashboard> {
Color color;
IconData icon;
// Phase 10: 색체심리학 기반 알림 색상 체계 적용
switch (type) {
case 'expiring_7':
color = Colors.red.shade600;
color = ShadcnTheme.alertCritical7; // 7일 이내 - 위험 (레드)
icon = Icons.priority_high_outlined;
break;
case 'expiring_30':
color = Colors.orange.shade600;
color = ShadcnTheme.alertWarning30; // 30일 이내 - 경고 (오렌지)
icon = Icons.warning_amber_outlined;
break;
case 'expiring_60':
color = Colors.amber.shade600;
color = ShadcnTheme.alertWarning60; // 60일 이내 - 주의 (앰버)
icon = Icons.schedule_outlined;
break;
case 'expired':
color = Colors.red.shade800;
color = ShadcnTheme.alertExpired; // 만료됨 - 심각 (진한 레드)
icon = Icons.error_outline;
break;
default:
color = Colors.grey.shade600;
color = ShadcnTheme.alertNormal; // 정상 - 안전 (그린)
icon = Icons.info_outline;
}
@@ -449,13 +450,14 @@ class _MaintenanceAlertDashboardState extends State<MaintenanceAlertDashboard> {
),
),
// 고객사
// 고객사 - Phase 10: 회사 타입별 색상 적용
Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
child: Text(
controller.getCompanyName(maintenance),
style: ShadcnTheme.bodySmall.copyWith(
color: ShadcnTheme.foreground,
color: ShadcnTheme.companyCustomer, // 고객사 - 진한 그린
fontWeight: FontWeight.w500,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -468,12 +470,13 @@ class _MaintenanceAlertDashboardState extends State<MaintenanceAlertDashboard> {
child: Text(
'${maintenance.endedAt.year}-${maintenance.endedAt.month.toString().padLeft(2, '0')}-${maintenance.endedAt.day.toString().padLeft(2, '0')}',
style: ShadcnTheme.bodySmall.copyWith(
// Phase 10: 만료 상태별 색상 체계 적용
color: isExpired
? Colors.red.shade600
? ShadcnTheme.alertExpired // 만료됨 - 심각 (진한 레드)
: isExpiringSoon
? Colors.orange.shade600
: ShadcnTheme.foreground,
fontWeight: isExpired || isExpiringSoon ? FontWeight.w600 : FontWeight.normal,
? ShadcnTheme.alertWarning30 // 만료 임박 - 경고 (오렌지)
: ShadcnTheme.alertNormal, // 정상 - 안전 (그린)
fontWeight: isExpired || isExpiringSoon ? FontWeight.w600 : FontWeight.w500,
),
),
),
@@ -506,11 +509,12 @@ class _MaintenanceAlertDashboardState extends State<MaintenanceAlertDashboard> {
? '${daysRemaining.abs()}일 지연'
: '$daysRemaining일 남음',
style: ShadcnTheme.bodySmall.copyWith(
// Phase 10: 남은 일수 상태별 색상 체계 적용
color: isExpired
? Colors.red.shade600
? ShadcnTheme.alertExpired // 지연 - 심각 (진한 레드)
: isExpiringSoon
? Colors.orange.shade600
: Colors.green.shade600,
? ShadcnTheme.alertWarning30 // 임박 - 경고 (오렌지)
: ShadcnTheme.alertNormal, // 충분 - 안전 (그린)
fontWeight: FontWeight.w600,
),
),
@@ -543,14 +547,15 @@ class _MaintenanceAlertDashboardState extends State<MaintenanceAlertDashboard> {
}
/// 유지보수 타입별 색상
// Phase 10: 유지보수 타입별 색상 체계
Color _getMaintenanceTypeColor(String maintenanceType) {
switch (maintenanceType) {
case 'V': // 방문
return Colors.blue.shade600;
case 'R': // 원격
return Colors.green.shade600;
case 'V': // 방문 - 본사/지점 계열 (블루)
return ShadcnTheme.companyHeadquarters;
case 'R': // 원격 - 협력/성장 계열 (그린)
return ShadcnTheme.companyPartner;
default:
return Colors.grey.shade600;
return ShadcnTheme.muted;
}
}

View File

@@ -70,13 +70,26 @@ class _MaintenanceListState extends State<MaintenanceList> {
value: _controller,
child: Scaffold(
backgroundColor: ShadcnTheme.background,
body: Column(
children: [
_buildActionBar(),
_buildFilterBar(),
Expanded(child: _buildMainContent()),
_buildBottomBar(),
],
body: Consumer<MaintenanceController>(
builder: (context, controller, child) {
return Column(
children: [
_buildActionBar(),
_buildFilterBar(),
Expanded(child: _buildMainContent()),
Container(
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
decoration: BoxDecoration(
color: ShadcnTheme.card,
border: Border(
top: BorderSide(color: ShadcnTheme.border),
),
),
child: _buildPagination(controller),
),
],
);
},
),
),
);
@@ -260,209 +273,299 @@ class _MaintenanceListState extends State<MaintenanceList> {
/// 데이터 테이블
Widget _buildDataTable(MaintenanceController controller) {
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
controller: _horizontalScrollController,
child: DataTable(
columns: _buildHeaders(),
rows: _buildRows(controller.maintenances),
final maintenances = controller.maintenances;
if (maintenances.isEmpty) {
return const StandardEmptyState(
icon: Icons.build_circle_outlined,
title: '유지보수가 없습니다',
message: '새로운 유지보수를 등록해보세요.',
);
}
return Container(
decoration: BoxDecoration(
border: Border.all(color: ShadcnTheme.border),
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
),
child: Column(
children: [
// 고정 헤더
Container(
padding: const EdgeInsets.symmetric(horizontal: ShadcnTheme.spacing4, vertical: ShadcnTheme.spacing3),
decoration: BoxDecoration(
color: ShadcnTheme.muted.withValues(alpha: 0.3),
border: Border(bottom: BorderSide(color: ShadcnTheme.border)),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ShadcnTheme.radiusMd),
topRight: Radius.circular(ShadcnTheme.radiusMd),
),
),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
controller: _horizontalScrollController,
child: _buildFixedHeader(),
),
),
// 스크롤 가능한 바디
Expanded(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
controller: _horizontalScrollController,
child: SizedBox(
width: _calculateTableWidth(),
child: ListView.builder(
itemCount: maintenances.length,
itemBuilder: (context, index) => _buildTableRow(maintenances[index], index),
),
),
),
),
],
),
);
}
/// 테이블 헤더
List<DataColumn> _buildHeaders() {
return [
const DataColumn(label: Text('선택')),
const DataColumn(label: Text('ID')),
const DataColumn(label: Text('장비 정보')),
const DataColumn(label: Text('유지보수 타입')),
const DataColumn(label: Text('시작일')),
const DataColumn(label: Text('종료일')),
if (_showDetailedColumns) ...[
const DataColumn(label: Text('주기')),
const DataColumn(label: Text('상태')),
const DataColumn(label: Text('남은 일수')),
],
const DataColumn(label: Text('작업')),
];
}
/// 테이블 로우
List<DataRow> _buildRows(List<MaintenanceDto> maintenances) {
return maintenances.map((maintenance) {
final isSelected = _selectedItems.contains(maintenance.id);
return DataRow(
selected: isSelected,
onSelectChanged: (_) => _showMaintenanceDetail(maintenance),
cells: [
// 선택 체크박스
DataCell(
Checkbox(
value: isSelected,
onChanged: (value) {
setState(() {
if (value == true) {
_selectedItems.add(maintenance.id!);
} else {
_selectedItems.remove(maintenance.id!);
}
});
},
),
),
// ID
DataCell(Text(maintenance.id?.toString() ?? '-')),
// 장비 정보
DataCell(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
maintenance.equipmentSerial ?? '시리얼 번호 없음',
style: const TextStyle(fontWeight: FontWeight.w500),
),
if (maintenance.equipmentModel != null)
Text(
maintenance.equipmentModel!,
style: TextStyle(
fontSize: 12,
color: Colors.grey[600],
),
),
],
),
),
// 유지보수 타입
DataCell(
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: _getMaintenanceTypeColor(maintenance.maintenanceType),
borderRadius: BorderRadius.circular(4),
),
child: Text(
MaintenanceType.getDisplayName(maintenance.maintenanceType),
style: const TextStyle(
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.w500,
),
),
),
),
// 시작일
DataCell(Text(DateFormat('yyyy-MM-dd').format(maintenance.startedAt))),
// 종료일
DataCell(Text(DateFormat('yyyy-MM-dd').format(maintenance.endedAt))),
// 상세 컬럼들
/// 고정 헤더 빌드
Widget _buildFixedHeader() {
return SizedBox(
width: _calculateTableWidth(),
child: Row(
children: [
_buildHeaderCell('선택', 60),
_buildHeaderCell('ID', 80),
_buildHeaderCell('장비 정보', 200),
_buildHeaderCell('유지보수 타입', 120),
_buildHeaderCell('시작일', 100),
_buildHeaderCell('종료일', 100),
if (_showDetailedColumns) ...[
// 주기
DataCell(Text('${maintenance.periodMonth}개월')),
// 상태
DataCell(
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: _controller.getMaintenanceStatusColor(maintenance),
borderRadius: BorderRadius.circular(4),
),
child: Text(
_controller.getMaintenanceStatusText(maintenance),
style: const TextStyle(
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.w500,
),
),
),
),
// 남은 일수
DataCell(
Text(
maintenance.daysRemaining != null
? '${maintenance.daysRemaining}'
: '-',
style: TextStyle(
color: maintenance.daysRemaining != null &&
maintenance.daysRemaining! <= 30
? Colors.red
: null,
),
),
),
_buildHeaderCell('주기', 80),
_buildHeaderCell('상태', 100),
_buildHeaderCell('남은 일수', 100),
],
// 작업 버튼들
DataCell(
Row(
mainAxisSize: MainAxisSize.min,
children: [
ShadButton.ghost(
child: const Icon(Icons.edit, size: 16),
onPressed: () => _showMaintenanceForm(maintenance: maintenance),
),
const SizedBox(width: 4),
ShadButton.ghost(
child: Icon(
Icons.delete,
size: 16,
color: Colors.red[400],
),
onPressed: () => _deleteMaintenance(maintenance),
),
],
),
),
_buildHeaderCell('작업', 120),
],
);
}).toList();
}
/// 하단바 (페이지네이션)
Widget _buildBottomBar() {
return Consumer<MaintenanceController>(
builder: (context, controller, child) {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: ShadcnTheme.card,
border: Border(
top: BorderSide(color: ShadcnTheme.border),
),
),
child: Row(
children: [
// 선택된 항목 정보
if (_selectedItems.isNotEmpty)
Text('${_selectedItems.length}개 선택됨'),
const Spacer(),
// 페이지네이션
Pagination(
totalCount: controller.totalCount,
currentPage: controller.currentPage,
pageSize: 20, // MaintenanceController._perPage 상수값
onPageChanged: (page) => controller.goToPage(page),
),
],
),
);
},
),
);
}
/// 테이블 총 너비 계산
double _calculateTableWidth() {
double width = 60 + 80 + 200 + 120 + 100 + 100 + 120; // 기본 컬럼들
if (_showDetailedColumns) {
width += 80 + 100 + 100; // 상세 컬럼들
}
return width;
}
/// 헤더 셀 빌드
Widget _buildHeaderCell(String text, double width) {
return Container(
width: width,
padding: const EdgeInsets.symmetric(horizontal: ShadcnTheme.spacing2),
child: Text(
text,
style: ShadcnTheme.bodyMedium.copyWith(fontWeight: FontWeight.w500),
),
);
}
/// 테이블 행 빌드
Widget _buildTableRow(MaintenanceDto maintenance, int index) {
return Container(
decoration: BoxDecoration(
color: index.isEven ? ShadcnTheme.muted.withValues(alpha: 0.1) : null,
border: Border(bottom: BorderSide(color: ShadcnTheme.border.withValues(alpha: 0.3))),
),
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () => _showMaintenanceDetail(maintenance),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: ShadcnTheme.spacing4, vertical: ShadcnTheme.spacing3),
child: Row(
children: [
// 선택 체크박스
SizedBox(
width: 60,
child: ShadCheckbox(
value: _selectedItems.contains(maintenance.id),
onChanged: (value) {
setState(() {
if (value == true) {
_selectedItems.add(maintenance.id!);
} else {
_selectedItems.remove(maintenance.id!);
}
});
},
),
),
// ID
SizedBox(
width: 80,
child: Text(
maintenance.id?.toString() ?? '-',
style: ShadcnTheme.bodySmall,
),
),
// 장비 정보
SizedBox(
width: 200,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
maintenance.equipmentSerial ?? '시리얼 번호 없음',
style: const TextStyle(fontWeight: FontWeight.w500),
overflow: TextOverflow.ellipsis,
),
if (maintenance.equipmentModel != null)
Text(
maintenance.equipmentModel!,
style: TextStyle(
fontSize: 12,
color: ShadcnTheme.mutedForeground,
),
overflow: TextOverflow.ellipsis,
),
],
),
),
// 유지보수 타입
SizedBox(
width: 120,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: ShadcnTheme.spacing2, vertical: ShadcnTheme.spacing1),
decoration: BoxDecoration(
color: _getMaintenanceTypeColor(maintenance.maintenanceType),
borderRadius: BorderRadius.circular(ShadcnTheme.radiusSm),
),
child: Text(
MaintenanceType.getDisplayName(maintenance.maintenanceType),
style: const TextStyle(
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.w500,
),
overflow: TextOverflow.ellipsis,
),
),
),
// 시작일
SizedBox(
width: 100,
child: Text(
DateFormat('yyyy-MM-dd').format(maintenance.startedAt),
style: ShadcnTheme.bodySmall,
),
),
// 종료일
SizedBox(
width: 100,
child: Text(
DateFormat('yyyy-MM-dd').format(maintenance.endedAt),
style: ShadcnTheme.bodySmall,
),
),
// 상세 컬럼들
if (_showDetailedColumns) ...[
// 주기
SizedBox(
width: 80,
child: Text(
'${maintenance.periodMonth}개월',
style: ShadcnTheme.bodySmall,
),
),
// 상태
SizedBox(
width: 100,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: ShadcnTheme.spacing2, vertical: ShadcnTheme.spacing1),
decoration: BoxDecoration(
color: _controller.getMaintenanceStatusColor(maintenance),
borderRadius: BorderRadius.circular(ShadcnTheme.radiusSm),
),
child: Text(
_controller.getMaintenanceStatusText(maintenance),
style: const TextStyle(
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.w500,
),
overflow: TextOverflow.ellipsis,
),
),
),
// 남은 일수
SizedBox(
width: 100,
child: Text(
maintenance.daysRemaining != null
? '${maintenance.daysRemaining}'
: '-',
style: TextStyle(
color: maintenance.daysRemaining != null &&
maintenance.daysRemaining! <= 30
? ShadcnTheme.destructive
: ShadcnTheme.foreground,
),
),
),
],
// 작업 버튼들
SizedBox(
width: 120,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
ShadButton.ghost(
child: const Icon(Icons.edit, size: 16),
onPressed: () => _showMaintenanceForm(maintenance: maintenance),
),
const SizedBox(width: ShadcnTheme.spacing1),
ShadButton.ghost(
child: Icon(
Icons.delete,
size: 16,
color: ShadcnTheme.destructive,
),
onPressed: () => _deleteMaintenance(maintenance),
),
],
),
),
],
),
),
),
),
);
}
/// 하단 페이지네이션
Widget _buildPagination(MaintenanceController controller) {
return Pagination(
totalCount: controller.totalCount,
currentPage: controller.currentPage,
pageSize: 20, // MaintenanceController._perPage 상수값
onPageChanged: (page) => controller.goToPage(page),
);
}
// 유틸리티 메서드들
Color _getMaintenanceTypeColor(String type) {
switch (type) {