From 388cf174bb84ace4836129e5cd5537686f03d32d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Thu, 12 Mar 2026 16:00:04 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[=EC=A0=84=ED=91=9C]=20=EC=9D=BC?= =?UTF-8?q?=EB=B0=98=EC=A0=84=ED=91=9C=20=EB=B3=B5=EC=82=AC=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 전표 수정 모달에 복사 버튼 추가 - 복사 시 일자 선택 다이얼로그 표시 - 선택한 일자 기준 신규 전표번호 자동 생성 - 분개 내역(계정과목, 금액, 거래처, 적요) 그대로 복사 --- .../views/finance/journal-entries.blade.php | 61 ++++++++++++++++--- 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/resources/views/finance/journal-entries.blade.php b/resources/views/finance/journal-entries.blade.php index 96a5f6cc..e695a65f 100644 --- a/resources/views/finance/journal-entries.blade.php +++ b/resources/views/finance/journal-entries.blade.php @@ -59,6 +59,7 @@ const Calendar = createIcon('calendar'); const CreditCard = createIcon('credit-card'); const Lock = createIcon('lock'); +const Copy = createIcon('copy'); const CSRF_TOKEN = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content'); @@ -1463,6 +1464,9 @@ className="p-1 text-stone-300 group-hover:text-emerald-500 hover:bg-emerald-50 r const [existingEntryNo, setExistingEntryNo] = useState(''); const [showAddPartnerModal, setShowAddPartnerModal] = useState(false); const [addPartnerLineIndex, setAddPartnerLineIndex] = useState(null); + const [isCopyMode, setIsCopyMode] = useState(false); + const [showCopyDialog, setShowCopyDialog] = useState(false); + const [copyDate, setCopyDate] = useState(getKoreanDate()); const getDefaultLines = () => [ { key: Date.now(), dc_type: 'debit', account_code: '', account_name: '', trading_partner_id: null, trading_partner_name: '', debit_amount: 0, credit_amount: 0, description: '' }, @@ -1481,8 +1485,8 @@ className="p-1 text-stone-300 group-hover:text-emerald-500 hover:bg-emerald-50 r }; useEffect(() => { - if (!isEditMode) fetchPreviewEntryNo(entryDate); - }, [entryDate]); + if (!isEditMode || isCopyMode) fetchPreviewEntryNo(entryDate); + }, [entryDate, isCopyMode]); // 수정 모드: 기존 전표 로드 useEffect(() => { @@ -1558,8 +1562,8 @@ className="p-1 text-stone-300 group-hover:text-emerald-500 hover:bg-emerald-50 r })), }; - const url = isEditMode ? `/finance/journal-entries/${entryId}` : '/finance/journal-entries/store'; - const method = isEditMode ? 'PUT' : 'POST'; + const url = (isEditMode && !isCopyMode) ? `/finance/journal-entries/${entryId}` : '/finance/journal-entries/store'; + const method = (isEditMode && !isCopyMode) ? 'PUT' : 'POST'; const res = await fetch(url, { method, headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-CSRF-TOKEN': CSRF_TOKEN }, @@ -1579,7 +1583,7 @@ className="p-1 text-stone-300 group-hover:text-emerald-500 hover:bg-emerald-50 r const data = await res.json(); if (data.success) { - notify(data.message || (isEditMode ? '전표가 수정되었습니다.' : '전표가 저장되었습니다.'), 'success'); + notify(data.message || (isCopyMode ? '전표가 복사되었습니다.' : isEditMode ? '전표가 수정되었습니다.' : '전표가 저장되었습니다.'), 'success'); onSaved(); } else { notify(data.message || '저장 실패', 'error'); @@ -1609,13 +1613,25 @@ className="p-1 text-stone-300 group-hover:text-emerald-500 hover:bg-emerald-50 r } }; + const handleCopyClick = () => { + setShowCopyDialog(true); + setCopyDate(getKoreanDate()); + }; + + const confirmCopy = () => { + setIsCopyMode(true); + setShowCopyDialog(false); + setEntryDate(copyDate); + fetchPreviewEntryNo(copyDate); + }; + return (
{/* 헤더 */}

- {isEditMode ? `전표 수정 (${existingEntryNo})` : '수동 전표 생성'} + {isCopyMode ? `전표 복사 (원본: ${existingEntryNo})` : isEditMode ? `전표 수정 (${existingEntryNo})` : '수동 전표 생성'}

)} + {isEditMode && !isCopyMode && ( + + )}
@@ -1809,6 +1831,25 @@ className={`px-6 py-2 text-sm font-medium rounded-lg flex items-center gap-1 tra setAddPartnerLineIndex(null); }} /> + + {/* 전표 복사 일자 선택 다이얼로그 */} + {showCopyDialog && ( +
+
+

전표 복사

+

복사할 전표의 일자를 선택하세요. 전표번호는 해당 일자 기준으로 자동 생성됩니다.

+ + setCopyDate(e.target.value)} + className="w-full px-3 py-2 text-sm border border-stone-200 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none mb-4" /> +
+ + +
+
+
+ )}
); };