From 62e0fe7f5ca094da17d62a0cf05e5bd8b56d6ff1 Mon Sep 17 00:00:00 2001 From: Yuka Higashide Date: Thu, 18 Sep 2025 14:12:50 +0900 Subject: [PATCH] =?UTF-8?q?=E9=A7=90=E8=BC=AA=E5=A0=B4=E6=A4=9C=E7=B4=A2?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6=E3=83=88?= =?UTF-8?q?=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/regular_contract/create.blade.php | 189 +++++++++--------- 1 file changed, 95 insertions(+), 94 deletions(-) diff --git a/resources/views/regular_contract/create.blade.php b/resources/views/regular_contract/create.blade.php index c0d741a..d04a1d7 100644 --- a/resources/views/regular_contract/create.blade.php +++ b/resources/views/regular_contract/create.blade.php @@ -51,100 +51,101 @@ - - - - - - - - - - - - - - @forelse($parks_table as $row) - - - - - {{-- 自転車・原付・自動二輪・自動車列 --}} - @foreach(['自転車', '原付', '自動二輪', '自動車'] as $vehicle) - - @endforeach - - @empty - - - - @endforelse - -
- 駐輪場名 - - - - 市町村名 - - - - 駅名 - - - 自転車原付自動二輪自動車
- {{ $row->park_name }} - {{ $row->city_name }}{{ $row->station_neighbor_station }} - @php - $zonesForType = ($zones[$row->park_id] ?? collect())->where('psection_subject', $vehicle); - @endphp - @forelse ($zonesForType as $zone) - @php - $reserveCount = ($reserve[$row->park_id] ?? collect()) - ->where('psection_id', $zone->psection_id) - ->count(); - $vacancy = $zone->zone_tolerance - $zone->zone_number - $reserveCount; - // 猶予期間判定 - $grace = $city_grace_periods[$row->city_id] ?? null; - $now = \Carbon\Carbon::now(); - $inGrace = false; - if ($grace && $grace->update_grace_period_start_date && $grace->update_grace_period_start_time && $grace->update_grace_period_end_date && $grace->update_grace_period_end_time) { - $year = $now->year; - $month = $now->month; - $startDay = (int)$grace->update_grace_period_start_date; - $endDay = (int)$grace->update_grace_period_end_date; - if ($startDay > $endDay) { - // 月またぎ - // 前月の開始日~今月の終了日 - $prevMonth = $now->copy()->subMonth(); - $startPrev = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $prevMonth->year, $prevMonth->month, $startDay, $grace->update_grace_period_start_time)); - $endCurr = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $year, $month, $endDay, $grace->update_grace_period_end_time)); - // 今月の開始日~翌月の終了日 - $startCurr = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $year, $month, $startDay, $grace->update_grace_period_start_time)); - $nextMonth = $month == 12 ? 1 : $month + 1; - $nextYear = $month == 12 ? $year + 1 : $year; - $endNext = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $nextYear, $nextMonth, $endDay, $grace->update_grace_period_end_time)); - $inGrace = $now->between($startPrev, $endCurr) || $now->between($startCurr, $endNext); - } else { - // 同月 - $start = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $year, $month, $startDay, $grace->update_grace_period_start_time)); - $end = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $year, $month, $endDay, $grace->update_grace_period_end_time)); - $inGrace = $now->between($start, $end); - } - } - @endphp - @if ($vacancy > 0 && $inGrace) - - @elseif (!$inGrace) - - @elseif ($vacancy <= 0 && $inGrace) - - @endif - @empty - - @endforelse -
該当する駐輪場はありません。
- +
+ + + + + + + + + + + + + + @forelse($parks_table as $row) + + + + + {{-- 自転車・原付・自動二輪・自動車列 --}} + @foreach(['自転車', '原付', '自動二輪', '自動車'] as $vehicle) + + @endforeach + + @empty + + + + @endforelse + +
+ 駐輪場名 + + + + 市町村名 + + + + 駅名 + + + 自転車原付自動二輪自動車
+ {{ $row->park_name }} + {{ $row->city_name }}{{ $row->station_neighbor_station }} + @php + $zonesForType = ($zones[$row->park_id] ?? collect())->where('psection_subject', $vehicle); + @endphp + @forelse ($zonesForType as $zone) + @php + $reserveCount = ($reserve[$row->park_id] ?? collect()) + ->where('psection_id', $zone->psection_id) + ->count(); + $vacancy = $zone->zone_tolerance - $zone->zone_number - $reserveCount; + // 猶予期間判定 + $grace = $city_grace_periods[$row->city_id] ?? null; + $now = \Carbon\Carbon::now(); + $inGrace = false; + if ($grace && $grace->update_grace_period_start_date && $grace->update_grace_period_start_time && $grace->update_grace_period_end_date && $grace->update_grace_period_end_time) { + $year = $now->year; + $month = $now->month; + $startDay = (int)$grace->update_grace_period_start_date; + $endDay = (int)$grace->update_grace_period_end_date; + if ($startDay > $endDay) { + // 月またぎ + // 前月の開始日~今月の終了日 + $prevMonth = $now->copy()->subMonth(); + $startPrev = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $prevMonth->year, $prevMonth->month, $startDay, $grace->update_grace_period_start_time)); + $endCurr = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $year, $month, $endDay, $grace->update_grace_period_end_time)); + // 今月の開始日~翌月の終了日 + $startCurr = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $year, $month, $startDay, $grace->update_grace_period_start_time)); + $nextMonth = $month == 12 ? 1 : $month + 1; + $nextYear = $month == 12 ? $year + 1 : $year; + $endNext = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $nextYear, $nextMonth, $endDay, $grace->update_grace_period_end_time)); + $inGrace = $now->between($startPrev, $endCurr) || $now->between($startCurr, $endNext); + } else { + // 同月 + $start = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $year, $month, $startDay, $grace->update_grace_period_start_time)); + $end = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $year, $month, $endDay, $grace->update_grace_period_end_time)); + $inGrace = $now->between($start, $end); + } + } + @endphp + @if ($vacancy > 0 && $inGrace) + + @elseif (!$inGrace) + + @elseif ($vacancy <= 0 && $inGrace) + + @endif + @empty + + @endforelse +
該当する駐輪場はありません。
+
@php $totalPages = ceil($parks_table_total / $parks_table_perPage); $currentPage = $parks_table_page; -- 2.47.3