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:
@@ -153,163 +153,6 @@ class _RentListScreenState extends State<RentListScreen> {
|
||||
_controller.loadRents();
|
||||
}
|
||||
|
||||
/// 헤더 셀 빌더
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// 헤더 셀 리스트
|
||||
List<Widget> _buildHeaderCells() {
|
||||
return [
|
||||
_buildHeaderCell('ID', flex: 0, useExpanded: false, minWidth: 60),
|
||||
_buildHeaderCell('장비 이력 ID', flex: 1, useExpanded: true, minWidth: 100),
|
||||
_buildHeaderCell('시작일', flex: 1, useExpanded: true, minWidth: 100),
|
||||
_buildHeaderCell('종료일', flex: 1, useExpanded: true, minWidth: 100),
|
||||
_buildHeaderCell('기간 (일)', flex: 0, useExpanded: false, minWidth: 80),
|
||||
_buildHeaderCell('상태', flex: 0, useExpanded: false, minWidth: 80),
|
||||
_buildHeaderCell('작업', flex: 0, useExpanded: false, minWidth: 120),
|
||||
];
|
||||
}
|
||||
|
||||
/// 테이블 행 빌더
|
||||
Widget _buildTableRow(RentDto rent, int index) {
|
||||
final days = _controller.calculateRentDays(rent.startedAt, rent.endedAt);
|
||||
final status = _controller.getRentStatus(rent);
|
||||
|
||||
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(
|
||||
rent.id?.toString() ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 60,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
rent.equipmentHistoryId.toString(),
|
||||
style: ShadcnTheme.bodyMedium,
|
||||
),
|
||||
flex: 1,
|
||||
useExpanded: true,
|
||||
minWidth: 100,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
DateFormat('yyyy-MM-dd').format(rent.startedAt),
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
flex: 1,
|
||||
useExpanded: true,
|
||||
minWidth: 100,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
DateFormat('yyyy-MM-dd').format(rent.endedAt),
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
flex: 1,
|
||||
useExpanded: true,
|
||||
minWidth: 100,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
'$days일',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildStatusChip(status),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () => _showEditDialog(rent),
|
||||
child: const Icon(Icons.edit, size: 16),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
if (status == '진행중')
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () => _returnRent(rent),
|
||||
child: const Icon(Icons.assignment_return, size: 16),
|
||||
),
|
||||
if (status == '진행중')
|
||||
const SizedBox(width: 4),
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () => _deleteRent(rent),
|
||||
child: const Icon(Icons.delete, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 120,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 상태 배지 빌더
|
||||
Widget _buildStatusChip(String? status) {
|
||||
switch (status) {
|
||||
@@ -332,59 +175,196 @@ class _RentListScreenState extends State<RentListScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// 데이터 테이블 빌더
|
||||
Widget _buildDataTable(RentController controller) {
|
||||
final rents = controller.rents;
|
||||
|
||||
|
||||
if (rents.isEmpty) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.business_center_outlined,
|
||||
size: 64,
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
const SizedBox(height: ShadcnTheme.spacing4),
|
||||
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),
|
||||
padding: const EdgeInsets.symmetric(horizontal: ShadcnTheme.spacing4, vertical: ShadcnTheme.spacing3),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||
border: Border(bottom: BorderSide(color: Colors.black)),
|
||||
border: Border(bottom: BorderSide(color: ShadcnTheme.border)),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(ShadcnTheme.radiusMd),
|
||||
topRight: Radius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
_buildHeaderCell('ID', 60),
|
||||
_buildHeaderCell('장비 이력 ID', 120),
|
||||
_buildHeaderCell('시작일', 100),
|
||||
_buildHeaderCell('종료일', 100),
|
||||
_buildHeaderCell('기간 (일)', 80),
|
||||
_buildHeaderCell('상태', 80),
|
||||
_buildHeaderCell('작업', 140),
|
||||
],
|
||||
),
|
||||
child: Row(children: _buildHeaderCells()),
|
||||
),
|
||||
// 스크롤 바디
|
||||
|
||||
// 스크롤 가능한 바디
|
||||
Expanded(
|
||||
child: rents.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.business_center_outlined,
|
||||
size: 64,
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'등록된 임대 계약이 없습니다',
|
||||
style: ShadcnTheme.bodyMedium.copyWith(
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: rents.length,
|
||||
itemBuilder: (context, index) => _buildTableRow(rents[index], index),
|
||||
),
|
||||
child: ListView.builder(
|
||||
itemCount: rents.length,
|
||||
itemBuilder: (context, index) => _buildTableRow(rents[index], index),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 헤더 셀 빌드
|
||||
Widget _buildHeaderCell(String text, double width) {
|
||||
return SizedBox(
|
||||
width: width,
|
||||
child: Text(
|
||||
text,
|
||||
style: ShadcnTheme.bodyMedium.copyWith(fontWeight: FontWeight.w500),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 테이블 행 빌드
|
||||
Widget _buildTableRow(RentDto rent, int index) {
|
||||
final days = _controller.calculateRentDays(rent.startedAt, rent.endedAt);
|
||||
final status = _controller.getRentStatus(rent);
|
||||
|
||||
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: () => _showEditDialog(rent),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: ShadcnTheme.spacing4, vertical: ShadcnTheme.spacing3),
|
||||
child: Row(
|
||||
children: [
|
||||
// ID
|
||||
SizedBox(
|
||||
width: 60,
|
||||
child: Text(
|
||||
rent.id?.toString() ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
|
||||
// 장비 이력 ID
|
||||
SizedBox(
|
||||
width: 120,
|
||||
child: Text(
|
||||
rent.equipmentHistoryId.toString(),
|
||||
style: ShadcnTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
|
||||
// 시작일
|
||||
SizedBox(
|
||||
width: 100,
|
||||
child: Text(
|
||||
DateFormat('yyyy-MM-dd').format(rent.startedAt),
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
|
||||
// 종료일
|
||||
SizedBox(
|
||||
width: 100,
|
||||
child: Text(
|
||||
DateFormat('yyyy-MM-dd').format(rent.endedAt),
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
|
||||
// 기간 (일)
|
||||
SizedBox(
|
||||
width: 80,
|
||||
child: Text(
|
||||
'$days일',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
|
||||
// 상태
|
||||
SizedBox(
|
||||
width: 80,
|
||||
child: _buildStatusChip(status),
|
||||
),
|
||||
|
||||
// 작업 버튼들
|
||||
SizedBox(
|
||||
width: 140,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () => _showEditDialog(rent),
|
||||
child: const Icon(Icons.edit, size: 16),
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing1),
|
||||
if (status == '진행중')
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () => _returnRent(rent),
|
||||
child: const Icon(Icons.assignment_return, size: 16),
|
||||
),
|
||||
if (status == '진행중')
|
||||
const SizedBox(width: ShadcnTheme.spacing1),
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () => _deleteRent(rent),
|
||||
child: Icon(
|
||||
Icons.delete,
|
||||
size: 16,
|
||||
color: ShadcnTheme.destructive,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 검색바 빌더
|
||||
Widget _buildSearchBar() {
|
||||
return Row(
|
||||
@@ -465,13 +445,21 @@ class _RentListScreenState extends State<RentListScreen> {
|
||||
Widget? _buildPagination() {
|
||||
return Consumer<RentController>(
|
||||
builder: (context, controller, child) {
|
||||
if (controller.totalPages <= 1) return const SizedBox.shrink();
|
||||
|
||||
return Pagination(
|
||||
totalCount: controller.totalRents,
|
||||
currentPage: controller.currentPage,
|
||||
pageSize: AppConstants.rentPageSize,
|
||||
onPageChanged: (page) => controller.loadRents(page: page),
|
||||
// 항상 페이지네이션 정보 표시 (총 개수라도)
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: ShadcnTheme.spacing2),
|
||||
child: controller.totalPages > 1
|
||||
? Pagination(
|
||||
totalCount: controller.totalRents,
|
||||
currentPage: controller.currentPage,
|
||||
pageSize: AppConstants.rentPageSize,
|
||||
onPageChanged: (page) => controller.loadRents(page: page),
|
||||
)
|
||||
: Text(
|
||||
'총 ${controller.totalRents}개 임대 계약',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user