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;