From 5fe5479d749c5fcdaa60d2f097afa322d0429ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Thu, 5 Feb 2026 20:22:32 +0900 Subject: [PATCH] =?UTF-8?q?feat:=EC=9E=90=EA=B8=88=EA=B3=84=ED=9A=8D?= =?UTF-8?q?=EC=9D=BC=EC=A0=95=20=EB=8B=AC=EB=A0=A5=EC=97=90=20=ED=9C=B4?= =?UTF-8?q?=EC=9D=BC=20=ED=91=9C=EC=8B=9C=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit holidays 테이블에서 휴일 조회하여 달력에 빨간색 배경 + 휴일명 표시 Co-Authored-By: Claude Opus 4.5 --- .../Finance/FundScheduleController.php | 34 ++++++++++++++++++- .../partials/calendar.blade.php | 27 +++++++++------ 2 files changed, 50 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/Finance/FundScheduleController.php b/app/Http/Controllers/Finance/FundScheduleController.php index 7bbb5f2f..83c35ffe 100644 --- a/app/Http/Controllers/Finance/FundScheduleController.php +++ b/app/Http/Controllers/Finance/FundScheduleController.php @@ -5,6 +5,7 @@ use App\Http\Controllers\Controller; use App\Models\Finance\BankAccount; use App\Models\Finance\FundSchedule; +use App\Models\System\Holiday; use App\Services\FundScheduleService; use Illuminate\Contracts\View\View; use Illuminate\Http\Response; @@ -37,12 +38,17 @@ public function index(): View|Response // 계좌 목록 (필터용) $accounts = BankAccount::active()->ordered()->get(['id', 'bank_name', 'account_number']); + // 휴일 데이터 (달력 표시용) + $tenantId = session('selected_tenant_id', 1); + $holidayMap = $this->getHolidayMap($tenantId, $year, $month); + return view('finance.fund-schedules.index', compact( 'year', 'month', 'calendarData', 'summary', - 'accounts' + 'accounts', + 'holidayMap' )); } @@ -106,4 +112,30 @@ public function show(int $id): View return view('finance.fund-schedules.show', compact('schedule')); } + + /** + * 해당 월의 휴일 맵 생성 (날짜 => 휴일명) + */ + private function getHolidayMap(int $tenantId, int $year, int $month): array + { + $startOfMonth = \Carbon\Carbon::create($year, $month, 1)->startOfWeek(\Carbon\Carbon::SUNDAY); + $endOfMonth = \Carbon\Carbon::create($year, $month, 1)->endOfMonth()->endOfWeek(\Carbon\Carbon::SATURDAY); + + $holidays = Holiday::forTenant($tenantId) + ->where('start_date', '<=', $endOfMonth->toDateString()) + ->where('end_date', '>=', $startOfMonth->toDateString()) + ->get(); + + $map = []; + foreach ($holidays as $holiday) { + $start = $holiday->start_date->copy(); + $end = $holiday->end_date->copy(); + for ($d = $start; $d->lte($end); $d->addDay()) { + $key = $d->format('Y-m-d'); + $map[$key] = $holiday->name; + } + } + + return $map; + } } diff --git a/resources/views/finance/fund-schedules/partials/calendar.blade.php b/resources/views/finance/fund-schedules/partials/calendar.blade.php index df00bb6c..27b7015c 100644 --- a/resources/views/finance/fund-schedules/partials/calendar.blade.php +++ b/resources/views/finance/fund-schedules/partials/calendar.blade.php @@ -38,21 +38,28 @@ $isSunday = $currentDate->dayOfWeek === Carbon::SUNDAY; $isSaturday = $currentDate->dayOfWeek === Carbon::SATURDAY; $daySchedules = $calendarData[$dateKey] ?? []; + $holidayName = $holidayMap[$dateKey] ?? null; + $isHoliday = $holidayName !== null; @endphp - +
{{-- 날짜 --}}
- - {{ $currentDate->day }} - +
+ + {{ $currentDate->day }} + + @if($isHoliday && $isCurrentMonth) + {{ $holidayName }} + @endif +
@if($isCurrentMonth)