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:
@@ -162,13 +162,13 @@ class _CompanyListState extends State<CompanyList> {
|
||||
}
|
||||
|
||||
|
||||
/// 본사/지점 구분 배지 생성
|
||||
/// 본사/지점 구분 배지 생성 - Phase 10: 색체심리학 기반 색상 적용
|
||||
Widget _buildCompanyTypeLabel(bool isBranch) {
|
||||
return ShadcnBadge(
|
||||
text: isBranch ? '지점' : '본사',
|
||||
variant: isBranch
|
||||
? ShadcnBadgeVariant.companyBranch // Purple (#7C3AED) - 차별화
|
||||
: ShadcnBadgeVariant.companyHeadquarters, // Blue (#2563EB)
|
||||
? ShadcnBadgeVariant.companyBranch // Phase 10: 지점 - 밝은 파랑
|
||||
: ShadcnBadgeVariant.companyHeadquarters, // Phase 10: 본사 - 진한 파랑
|
||||
size: ShadcnBadgeSize.small,
|
||||
);
|
||||
}
|
||||
@@ -261,7 +261,7 @@ class _CompanyListState extends State<CompanyList> {
|
||||
if (item.isPartner) {
|
||||
flags.add(ShadcnBadge(
|
||||
text: '파트너',
|
||||
variant: ShadcnBadgeVariant.companyPartner,
|
||||
variant: ShadcnBadgeVariant.companyPartner, // Phase 10: 협력 - 에메랄드
|
||||
size: ShadcnBadgeSize.small,
|
||||
));
|
||||
}
|
||||
@@ -269,7 +269,7 @@ class _CompanyListState extends State<CompanyList> {
|
||||
if (item.isCustomer) {
|
||||
flags.add(ShadcnBadge(
|
||||
text: '고객',
|
||||
variant: ShadcnBadgeVariant.companyCustomer,
|
||||
variant: ShadcnBadgeVariant.companyCustomer, // Phase 10: 고객 - 진한 그린
|
||||
size: ShadcnBadgeSize.small,
|
||||
));
|
||||
}
|
||||
@@ -313,259 +313,105 @@ class _CompanyListState extends State<CompanyList> {
|
||||
}
|
||||
}
|
||||
|
||||
/// 헤더 셀 빌더
|
||||
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),
|
||||
),
|
||||
);
|
||||
// (Deprecated) 기존 커스텀 테이블 빌더 유틸들은 ShadTable 전환으로 제거되었습니다.
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// 헤더 셀 리스트
|
||||
List<Widget> _buildHeaderCells() {
|
||||
return [
|
||||
_buildHeaderCell('번호', flex: 0, useExpanded: false, minWidth: 50),
|
||||
_buildHeaderCell('회사명', flex: 3, useExpanded: true, minWidth: 120),
|
||||
_buildHeaderCell('구분', flex: 0, useExpanded: false, minWidth: 60),
|
||||
_buildHeaderCell('주소', flex: 2, useExpanded: true, minWidth: 100),
|
||||
_buildHeaderCell('담당자', flex: 2, useExpanded: true, minWidth: 80),
|
||||
_buildHeaderCell('연락처', flex: 2, useExpanded: true, minWidth: 100),
|
||||
_buildHeaderCell('파트너/고객', flex: 1, useExpanded: true, minWidth: 80),
|
||||
_buildHeaderCell('상태', flex: 0, useExpanded: false, minWidth: 60),
|
||||
_buildHeaderCell('등록/수정일', flex: 2, useExpanded: true, minWidth: 100),
|
||||
_buildHeaderCell('비고', flex: 1, useExpanded: true, minWidth: 80),
|
||||
_buildHeaderCell('관리', flex: 0, useExpanded: false, minWidth: 100),
|
||||
];
|
||||
}
|
||||
|
||||
/// 테이블 행 빌더
|
||||
Widget _buildTableRow(CompanyItem item, int index, CompanyListController controller) {
|
||||
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(
|
||||
_buildDisplayNameText(item),
|
||||
flex: 3,
|
||||
useExpanded: true,
|
||||
minWidth: 120,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildCompanyTypeLabel(item.isBranch),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 60,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
item.address.isNotEmpty ? item.address : '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 100,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildContactInfo(item),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildContactDetails(item),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 100,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildPartnerCustomerFlags(item),
|
||||
flex: 1,
|
||||
useExpanded: true,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildStatusBadge(item.isActive),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 60,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildDateInfo(item),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 100,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
item.remark ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
),
|
||||
flex: 1,
|
||||
useExpanded: true,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (item.id != null) ...[
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () {
|
||||
if (item.isBranch) {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
'/company/branch/edit',
|
||||
arguments: {
|
||||
'companyId': item.parentCompanyId,
|
||||
'branchId': item.id,
|
||||
'parentCompanyName': item.parentCompanyName,
|
||||
},
|
||||
).then((result) {
|
||||
if (result == true) controller.refresh();
|
||||
});
|
||||
} else {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
'/company/edit',
|
||||
arguments: {
|
||||
'companyId': item.id,
|
||||
'isBranch': false,
|
||||
},
|
||||
).then((result) {
|
||||
if (result == true) controller.refresh();
|
||||
});
|
||||
}
|
||||
},
|
||||
child: const Icon(Icons.edit, size: 16),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () {
|
||||
if (item.isBranch) {
|
||||
_deleteBranch(item.parentCompanyId!, item.id!);
|
||||
} else {
|
||||
_deleteCompany(item.id!);
|
||||
}
|
||||
},
|
||||
child: const Icon(Icons.delete, size: 16),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 100,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 헤더 고정 패턴 회사 테이블 빌더
|
||||
/// ShadTable 기반 회사 테이블 빌더 (기존 컬럼 구성 유지)
|
||||
Widget _buildCompanyShadTable(List<CompanyItem> items, CompanyListController controller) {
|
||||
if (items.isEmpty) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.business_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: items.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.business_outlined,
|
||||
size: 64,
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
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('파트너/고객')),
|
||||
ShadTableCell.header(child: Text('상태')),
|
||||
ShadTableCell.header(child: Text('등록/수정일')),
|
||||
ShadTableCell.header(child: Text('비고')),
|
||||
ShadTableCell.header(child: Text('관리')),
|
||||
],
|
||||
children: [
|
||||
for (int index = 0; index < items.length; index++)
|
||||
[
|
||||
// 번호
|
||||
ShadTableCell(child: Text(((((controller.currentPage - 1) * controller.pageSize) + index + 1)).toString(), style: ShadcnTheme.bodySmall)),
|
||||
// 회사명 (본사>지점 표기 유지)
|
||||
ShadTableCell(child: _buildDisplayNameText(items[index])),
|
||||
// 구분 (본사/지점)
|
||||
ShadTableCell(child: _buildCompanyTypeLabel(items[index].isBranch)),
|
||||
// 주소
|
||||
ShadTableCell(child: Text(items[index].address.isNotEmpty ? items[index].address : '-', overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall)),
|
||||
// 담당자 요약
|
||||
ShadTableCell(child: _buildContactInfo(items[index])),
|
||||
// 연락처 상세
|
||||
ShadTableCell(child: _buildContactDetails(items[index])),
|
||||
// 파트너/고객 플래그
|
||||
ShadTableCell(child: _buildPartnerCustomerFlags(items[index])),
|
||||
// 상태
|
||||
ShadTableCell(child: _buildStatusBadge(items[index].isActive)),
|
||||
// 등록/수정일
|
||||
ShadTableCell(child: _buildDateInfo(items[index])),
|
||||
// 비고
|
||||
ShadTableCell(child: Text(items[index].remark ?? '-', overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall)),
|
||||
// 관리(편집/삭제)
|
||||
ShadTableCell(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (items[index].id != null) ...[
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () async {
|
||||
// 기존 편집 흐름 유지
|
||||
final args = {'companyId': items[index].id};
|
||||
final result = await Navigator.pushNamed(context, '/company/edit', arguments: args);
|
||||
if (result == true) {
|
||||
controller.refresh();
|
||||
}
|
||||
},
|
||||
child: const Icon(Icons.edit, size: 16),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'등록된 회사가 없습니다',
|
||||
style: ShadcnTheme.bodyMedium.copyWith(
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () {
|
||||
if (items[index].isBranch) {
|
||||
_deleteBranch(items[index].parentCompanyId!, items[index].id!);
|
||||
} else {
|
||||
_deleteCompany(items[index].id!);
|
||||
}
|
||||
},
|
||||
child: const Icon(Icons.delete, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: items.length,
|
||||
itemBuilder: (context, index) => _buildTableRow(items[index], index, controller),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -761,4 +607,4 @@ class _CompanyListState extends State<CompanyList> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user