Fix: 서적 편집 페이지 PDF 매칭 UI 개선

- PDF 매칭 드롭다운에서 현재 선택된 PDF가 올바르게 표시되도록 수정
- null 값과 빈 문자열 처리 개선 (option value를 null로 변경)
- PDF 매칭된 문서는 녹색 배경과 상태 표시 점으로 시각적 구분
- JavaScript에서 빈 문자열을 null로 변환하여 일관성 유지
This commit is contained in:
Hyungi Ahn
2025-09-03 18:32:58 +09:00
parent ca49ffec40
commit 77c18d31a9
2 changed files with 9 additions and 4 deletions

View File

@@ -146,14 +146,19 @@
<!-- PDF 매칭 및 컨트롤 -->
<div class="flex items-center space-x-3">
<!-- PDF 매칭 드롭다운 -->
<div class="min-w-48">
<div class="min-w-48 relative">
<select x-model="doc.matched_pdf_id"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm">
<option value="">PDF 매칭 없음</option>
:class="doc.matched_pdf_id ? 'border-green-300 bg-green-50' : 'border-gray-300'"
class="w-full px-3 py-2 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm">
<option :value="null">PDF 매칭 없음</option>
<template x-for="pdf in availablePDFs" :key="pdf.id">
<option :value="pdf.id" x-text="pdf.title"></option>
</template>
</select>
<!-- 매칭 상태 표시 -->
<div x-show="doc.matched_pdf_id" class="absolute -top-1 -right-1">
<div class="w-3 h-3 bg-green-500 rounded-full border-2 border-white"></div>
</div>
</div>
<!-- 이동 버튼 -->

View File

@@ -237,7 +237,7 @@ window.bookEditorApp = () => ({
return window.api.updateDocument(doc.id, {
sort_order: doc.sort_order,
matched_pdf_id: doc.matched_pdf_id || null
matched_pdf_id: doc.matched_pdf_id === "" ? null : doc.matched_pdf_id
});
});