장비 이력 상세보기 지원 및 상태/선택 동기화 개선
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

- EquipmentHistoryDialog: 좌우 분할 상세 패널(데스크톱) + 하단 시트(모바일) 추가
  • 거래일/유형/수량/창고/장비/회사/비고/생성·수정일 표시
  • 리스트 항목 선택 하이라이트, ID 복사 기능
- EquipmentListController: 이력 최신순 정렬 후 상태/일자 결정(오래된 순 가정 제거)
- EquipmentList(ShadTable): 체크박스 선택 시 컨트롤러 선택집합과 동기화
- ResponseInterceptor: equipment-history는 transaction_type 로깅, 장비 목록은 status 로깅으로 혼동 제거
This commit is contained in:
JiWoong Sul
2025-09-14 16:27:05 +09:00
parent d777333187
commit 7543df5a02
4 changed files with 232 additions and 18 deletions

View File

@@ -135,11 +135,16 @@ class EquipmentListController extends BaseListController<UnifiedEquipment> {
try {
final histories = await _historyService.getEquipmentHistoriesByEquipmentId(dto.id);
if (histories.isNotEmpty) {
// 최신 히스토리의 transaction_type 사용
// 히스토리는 최신순으로 정렬되어 있다고 가정
status = histories.first.transactionType ?? 'I';
transactionDate = histories.first.transactedAt ?? transactionDate;
print('DEBUG [EquipmentListController] Equipment ${dto.id} status from history: $status');
// 최신 히스토리를 기준으로 상태 결정 (서버 정렬 보장 없음 → 클라이언트 정렬)
histories.sort((a, b) {
final aDate = a.transactedAt ?? a.createdAt;
final bDate = b.transactedAt ?? b.createdAt;
return bDate.compareTo(aDate); // 내림차순: 최신 우선
});
final latest = histories.first;
status = latest.transactionType ?? 'I';
transactionDate = latest.transactedAt ?? transactionDate;
print('DEBUG [EquipmentListController] Equipment ${dto.id} latest status from history: $status @ ${latest.transactedAt ?? latest.createdAt}');
}
} catch (e) {
print('DEBUG [EquipmentListController] Failed to get history for equipment ${dto.id}: $e');