From 06cd50d1a605df23a07e9aa97ac92c25ac787406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Wed, 4 Mar 2026 12:57:42 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[ecard]=20=EA=B8=B0=EA=B0=84=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20stale=20closure=20=EB=AC=B8=EC=A0=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - loadTransactions/loadSplits/loadJournalStatuses에 명시적 날짜 파라미터 추가 - 조회 버튼 클릭 시 현재 날짜 직접 전달 - 편의 버튼(이번달/지난달/D-N월) 클릭 시 자동 검색 트리거 --- .../views/barobill/ecard/index.blade.php | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/resources/views/barobill/ecard/index.blade.php b/resources/views/barobill/ecard/index.blade.php index 1942180d..bfd7a015 100644 --- a/resources/views/barobill/ecard/index.blade.php +++ b/resources/views/barobill/ecard/index.blade.php @@ -2134,15 +2134,17 @@ className="px-3 py-1 bg-green-500 text-white text-xs rounded-lg hover:bg-green-6 } }; - const loadTransactions = async (page = 1) => { + const loadTransactions = async (page = 1, fromOverride = null, toOverride = null) => { + const from = fromOverride || dateFrom; + const to = toOverride || dateTo; setLoading(true); setError(null); setHasChanges(false); try { const params = new URLSearchParams({ - startDate: dateFrom.replace(/-/g, ''), - endDate: dateTo.replace(/-/g, ''), + startDate: from.replace(/-/g, ''), + endDate: to.replace(/-/g, ''), cardNum: selectedCard, page: page, limit: 200 @@ -2167,16 +2169,16 @@ className="px-3 py-1 bg-green-500 text-white text-xs rounded-lg hover:bg-green-6 } // 분리 데이터 로드 - loadSplits(); - loadJournalStatuses(); + loadSplits(from, to); + loadJournalStatuses(from, to); }; // 분리 데이터 로드 - const loadSplits = async () => { + const loadSplits = async (fromOverride = null, toOverride = null) => { try { const params = new URLSearchParams({ - startDate: dateFrom.replace(/-/g, ''), - endDate: dateTo.replace(/-/g, '') + startDate: (fromOverride || dateFrom).replace(/-/g, ''), + endDate: (toOverride || dateTo).replace(/-/g, '') }); const response = await fetch(`${API.splits}?${params}`); const data = await response.json(); @@ -2191,11 +2193,11 @@ className="px-3 py-1 bg-green-500 text-white text-xs rounded-lg hover:bg-green-6 }; // 복식부기 분개 상태 로드 - const loadJournalStatuses = async () => { + const loadJournalStatuses = async (fromOverride = null, toOverride = null) => { try { const params = new URLSearchParams({ - startDate: dateFrom.replace(/-/g, ''), - endDate: dateTo.replace(/-/g, '') + startDate: (fromOverride || dateFrom).replace(/-/g, ''), + endDate: (toOverride || dateTo).replace(/-/g, '') }); const response = await fetch(`${API.journalStatuses}?${params}`); const data = await response.json(); @@ -2733,6 +2735,7 @@ className="px-3 py-1 bg-green-500 text-white text-xs rounded-lg hover:bg-green-6 const dates = getMonthDates(0); setDateFrom(dates.from); setDateTo(dates.to); + loadTransactions(1, dates.from, dates.to); }; // 지난달 버튼 @@ -2740,6 +2743,7 @@ className="px-3 py-1 bg-green-500 text-white text-xs rounded-lg hover:bg-green-6 const dates = getMonthDates(-1); setDateFrom(dates.from); setDateTo(dates.to); + loadTransactions(1, dates.from, dates.to); }; // N개월 전 버튼 (offset: -2, -3, -4 등) @@ -2747,6 +2751,7 @@ className="px-3 py-1 bg-green-500 text-white text-xs rounded-lg hover:bg-green-6 const dates = getMonthDates(offset); setDateFrom(dates.from); setDateTo(dates.to); + loadTransactions(1, dates.from, dates.to); }; const formatCurrency = (val) => new Intl.NumberFormat('ko-KR').format(val || 0) + '원'; @@ -2877,7 +2882,7 @@ className="px-3 py-1.5 text-sm bg-stone-100 text-stone-600 rounded-lg hover:bg-s D-5월