fix(inventory): 상세 편집 플로우 안정화
- inbound/outbound/rental controller에 fetchTransactionDetail을 추가해 상세 동기화를 지원 - 각 페이지 초기화 시 결재 초안 로딩 권한을 PermissionScope에서 확인하도록 수정 - 상세 패널의 수정 버튼이 모달과 연동되도록 흐름을 정리하고 생성/수정 후 상세 데이터를 재조회 - 기존 결재 메모 필드는 등록 이후 수정 불가하도록 UI와 입력 상태를 비활성화 - 신규 상세-수정 위젯 테스트와 리포지토리 스텁 fetchDetail 구현을 추가 - flutter analyze, flutter test를 실행해 회귀를 점검
This commit is contained in:
@@ -240,6 +240,15 @@ class _StubStockTransactionRepository implements StockTransactionRepository {
|
||||
}) : _transactions = transactions;
|
||||
|
||||
final List<StockTransaction> _transactions;
|
||||
StockTransaction _findTransaction(int id) {
|
||||
final index = _transactions.indexWhere(
|
||||
(transaction) => transaction.id == id,
|
||||
);
|
||||
if (index == -1) {
|
||||
throw StateError('Transaction $id not found');
|
||||
}
|
||||
return _transactions[index];
|
||||
}
|
||||
|
||||
@override
|
||||
Future<PaginatedResult<StockTransaction>> list({
|
||||
@@ -302,8 +311,8 @@ class _StubStockTransactionRepository implements StockTransactionRepository {
|
||||
Future<StockTransaction> fetchDetail(
|
||||
int id, {
|
||||
List<String> include = const ['lines', 'customers', 'approval'],
|
||||
}) {
|
||||
throw UnimplementedError();
|
||||
}) async {
|
||||
return _findTransaction(id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -359,14 +368,9 @@ class _StubStockTransactionRepository implements StockTransactionRepository {
|
||||
int id,
|
||||
StockTransaction Function(StockTransaction transaction) transform,
|
||||
) async {
|
||||
final index = _transactions.indexWhere(
|
||||
(transaction) => transaction.id == id,
|
||||
);
|
||||
if (index == -1) {
|
||||
throw StateError('Transaction $id not found');
|
||||
}
|
||||
final current = _transactions[index];
|
||||
final current = _findTransaction(id);
|
||||
final updated = transform(current);
|
||||
final index = _transactions.indexOf(current);
|
||||
_transactions[index] = updated;
|
||||
return updated;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user