feat: [journal] 카드/은행 출처 전표 읽기 전용 적용

- update() 메서드에 source_type 가드 추가 (403 반환)
- 통합 목록에서 카드/은행 분개완료 행에 잠금 아이콘 표시
- handleEditEntry에 출처 전표 방어 가드 추가
- show() 응답에 source_type 필드 추가
This commit is contained in:
김보곤
2026-03-03 14:54:20 +09:00
parent 2ac4c188d5
commit 6a5976cc5d
2 changed files with 32 additions and 7 deletions

View File

@@ -58,6 +58,7 @@
const Settings = createIcon('settings');
const Calendar = createIcon('calendar');
const CreditCard = createIcon('credit-card');
const Lock = createIcon('lock');
const CSRF_TOKEN = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
@@ -1325,8 +1326,12 @@ className={`px-2.5 py-1 text-xs rounded-full font-medium transition-colors ${vie
className="px-2.5 py-1 text-xs font-medium bg-amber-100 text-amber-700 rounded-full hover:bg-amber-200 transition-colors">
분개
</button>
) : row.hasJournal ? (
<button onClick={() => row.type === 'bank' ? handleJournal(row.bankTx) : row.type === 'card' ? handleCardJournal(row.cardTx) : onEdit(row.journalId)}
) : (row.type === 'bank' || row.type === 'card') && row.hasJournal ? (
<span className="p-1 text-stone-300" title="카드/은행 출처 전표는 원본에서 수정하세요">
<Lock className="w-4 h-4" />
</span>
) : row.type === 'manual' && row.hasJournal ? (
<button onClick={() => onEdit(row.journalId)}
className="p-1 text-stone-300 group-hover:text-emerald-500 hover:bg-emerald-50 rounded transition-colors" title="수정">
<Edit3 className="w-4 h-4" />
</button>
@@ -2604,7 +2609,18 @@ function App() {
refreshJournalList();
};
const handleEditEntry = (entryId) => {
const handleEditEntry = async (entryId) => {
// 출처 연결 전표인지 확인 (UI에서 이미 차단하지만 방어 코드)
try {
const res = await fetch(`/finance/journal-entries/${entryId}`);
const data = await res.json();
if (data.success && data.data.source_type && data.data.source_type !== 'manual') {
notify('카드/은행/홈택스 출처 전표는 원본에서 수정해주세요.', 'warning');
return;
}
} catch (e) {
// 조회 실패 시에도 모달 열기 허용 (서버에서 update 시 재검증)
}
setEditEntryId(entryId);
setShowManualModal(true);
};