駐輪場検索画面レイアウト調整 #22
@ -51,100 +51,101 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<table id="searchTable" class="tablesorter table table-striped">
|
<div style="overflow-x: auto; width: 100%;">
|
||||||
<thead>
|
<table id="searchTable" class="tablesorter table table-striped">
|
||||||
<tr>
|
<thead>
|
||||||
<th class="header">
|
<tr>
|
||||||
駐輪場名
|
<th class="header">
|
||||||
<a href="{{ request()->fullUrlWithQuery(['sort' => 'park_ruby', 'order' => 'asc', 'page' => 1]) }}" class="text-success"><i class="bi bi-caret-up-fill"></i></a>
|
駐輪場名
|
||||||
<a href="{{ request()->fullUrlWithQuery(['sort' => 'park_ruby', 'order' => 'desc', 'page' => 1]) }}" class="text-success"><i class="bi bi-caret-down-fill"></i></a>
|
<a href="{{ request()->fullUrlWithQuery(['sort' => 'park_ruby', 'order' => 'asc', 'page' => 1]) }}" class="text-success"><i class="bi bi-caret-up-fill"></i></a>
|
||||||
</th>
|
<a href="{{ request()->fullUrlWithQuery(['sort' => 'park_ruby', 'order' => 'desc', 'page' => 1]) }}" class="text-success"><i class="bi bi-caret-down-fill"></i></a>
|
||||||
<th class="header">
|
</th>
|
||||||
市町村名
|
<th class="header">
|
||||||
<a href="{{ request()->fullUrlWithQuery(['sort' => 'city_id', 'order' => 'asc', 'page' => 1]) }}" class="text-success"><i class="bi bi-caret-up-fill"></i></a>
|
市町村名
|
||||||
<a href="{{ request()->fullUrlWithQuery(['sort' => 'city_id', 'order' => 'desc', 'page' => 1]) }}" class="text-success"><i class="bi bi-caret-down-fill"></i></a>
|
<a href="{{ request()->fullUrlWithQuery(['sort' => 'city_id', 'order' => 'asc', 'page' => 1]) }}" class="text-success"><i class="bi bi-caret-up-fill"></i></a>
|
||||||
</th>
|
<a href="{{ request()->fullUrlWithQuery(['sort' => 'city_id', 'order' => 'desc', 'page' => 1]) }}" class="text-success"><i class="bi bi-caret-down-fill"></i></a>
|
||||||
<th class="header">
|
</th>
|
||||||
駅名
|
<th class="header">
|
||||||
<a href="{{ request()->fullUrlWithQuery(['sort' => 'station_name_ruby', 'order' => 'asc', 'page' => 1]) }}" class="text-success"><i class="bi bi-caret-up-fill"></i></a>
|
駅名
|
||||||
<a href="{{ request()->fullUrlWithQuery(['sort' => 'station_name_ruby', 'order' => 'desc', 'page' => 1]) }}" class="text-success"><i class="bi bi-caret-down-fill"></i></a>
|
<a href="{{ request()->fullUrlWithQuery(['sort' => 'station_name_ruby', 'order' => 'asc', 'page' => 1]) }}" class="text-success"><i class="bi bi-caret-up-fill"></i></a>
|
||||||
</th>
|
<a href="{{ request()->fullUrlWithQuery(['sort' => 'station_name_ruby', 'order' => 'desc', 'page' => 1]) }}" class="text-success"><i class="bi bi-caret-down-fill"></i></a>
|
||||||
<th class="header">自転車</th>
|
</th>
|
||||||
<th class="header">原付</th>
|
<th class="header">自転車</th>
|
||||||
<th class="header">自動二輪</th>
|
<th class="header">原付</th>
|
||||||
<th class="header">自動車</th>
|
<th class="header">自動二輪</th>
|
||||||
</tr>
|
<th class="header">自動車</th>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody>
|
</thead>
|
||||||
@forelse($parks_table as $row)
|
<tbody>
|
||||||
<tr>
|
@forelse($parks_table as $row)
|
||||||
<td><a href="javascript:void(0);" class="btn-popup text-primary" data-park-id="{{ $row->park_id }}">
|
<tr>
|
||||||
{{ $row->park_name }}
|
<td><a href="javascript:void(0);" class="btn-popup text-primary" data-park-id="{{ $row->park_id }}">
|
||||||
</a></td>
|
{{ $row->park_name }}
|
||||||
<td>{{ $row->city_name }}</td>
|
</a></td>
|
||||||
<td>{{ $row->station_neighbor_station }}</td>
|
<td>{{ $row->city_name }}</td>
|
||||||
{{-- 自転車・原付・自動二輪・自動車列 --}}
|
<td>{{ $row->station_neighbor_station }}</td>
|
||||||
@foreach(['自転車', '原付', '自動二輪', '自動車'] as $vehicle)
|
{{-- 自転車・原付・自動二輪・自動車列 --}}
|
||||||
<td>
|
@foreach(['自転車', '原付', '自動二輪', '自動車'] as $vehicle)
|
||||||
@php
|
<td>
|
||||||
$zonesForType = ($zones[$row->park_id] ?? collect())->where('psection_subject', $vehicle);
|
@php
|
||||||
@endphp
|
$zonesForType = ($zones[$row->park_id] ?? collect())->where('psection_subject', $vehicle);
|
||||||
@forelse ($zonesForType as $zone)
|
@endphp
|
||||||
@php
|
@forelse ($zonesForType as $zone)
|
||||||
$reserveCount = ($reserve[$row->park_id] ?? collect())
|
@php
|
||||||
->where('psection_id', $zone->psection_id)
|
$reserveCount = ($reserve[$row->park_id] ?? collect())
|
||||||
->count();
|
->where('psection_id', $zone->psection_id)
|
||||||
$vacancy = $zone->zone_tolerance - $zone->zone_number - $reserveCount;
|
->count();
|
||||||
// 猶予期間判定
|
$vacancy = $zone->zone_tolerance - $zone->zone_number - $reserveCount;
|
||||||
$grace = $city_grace_periods[$row->city_id] ?? null;
|
// 猶予期間判定
|
||||||
$now = \Carbon\Carbon::now();
|
$grace = $city_grace_periods[$row->city_id] ?? null;
|
||||||
$inGrace = false;
|
$now = \Carbon\Carbon::now();
|
||||||
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) {
|
$inGrace = false;
|
||||||
$year = $now->year;
|
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) {
|
||||||
$month = $now->month;
|
$year = $now->year;
|
||||||
$startDay = (int)$grace->update_grace_period_start_date;
|
$month = $now->month;
|
||||||
$endDay = (int)$grace->update_grace_period_end_date;
|
$startDay = (int)$grace->update_grace_period_start_date;
|
||||||
if ($startDay > $endDay) {
|
$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));
|
$prevMonth = $now->copy()->subMonth();
|
||||||
$endCurr = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $year, $month, $endDay, $grace->update_grace_period_end_time));
|
$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;
|
$startCurr = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $year, $month, $startDay, $grace->update_grace_period_start_time));
|
||||||
$nextYear = $month == 12 ? $year + 1 : $year;
|
$nextMonth = $month == 12 ? 1 : $month + 1;
|
||||||
$endNext = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $nextYear, $nextMonth, $endDay, $grace->update_grace_period_end_time));
|
$nextYear = $month == 12 ? $year + 1 : $year;
|
||||||
$inGrace = $now->between($startPrev, $endCurr) || $now->between($startCurr, $endNext);
|
$endNext = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $nextYear, $nextMonth, $endDay, $grace->update_grace_period_end_time));
|
||||||
} else {
|
$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));
|
$start = \Carbon\Carbon::createFromFormat('Y-m-d H:i', sprintf('%04d-%02d-%02d %s', $year, $month, $startDay, $grace->update_grace_period_start_time));
|
||||||
$inGrace = $now->between($start, $end);
|
$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)
|
@endphp
|
||||||
<button class="btn btn-block btn-sm btn-outline-success btn_82-table btn-popup" data-park-id="{{ $row->park_id }}">定期契約</button>
|
@if ($vacancy > 0 && $inGrace)
|
||||||
@elseif (!$inGrace)
|
<button class="btn btn-block btn-sm btn-outline-success btn_82-table btn-popup" data-park-id="{{ $row->park_id }}">定期契約</button>
|
||||||
<button class="btn btn-block btn-sm btn-outline-danger btn_103-table btn-popup" data-park-id="{{ $row->park_id }}">販売期間外</button>
|
@elseif (!$inGrace)
|
||||||
@elseif ($vacancy <= 0 && $inGrace)
|
<button class="btn btn-block btn-sm btn-outline-danger btn_103-table btn-popup" data-park-id="{{ $row->park_id }}">販売期間外</button>
|
||||||
<button class="btn btn-block btn-sm btn-outline-danger btn_103-table btn-popup" data-park-id="{{ $row->park_id }}">空き待ち申込</button>
|
@elseif ($vacancy <= 0 && $inGrace)
|
||||||
@endif
|
<button class="btn btn-block btn-sm btn-outline-danger btn_103-table btn-popup" data-park-id="{{ $row->park_id }}">空き待ち申込</button>
|
||||||
@empty
|
@endif
|
||||||
<span class="text-muted"></span>
|
@empty
|
||||||
@endforelse
|
<span class="text-muted"></span>
|
||||||
</td>
|
@endforelse
|
||||||
@endforeach
|
</td>
|
||||||
</tr>
|
@endforeach
|
||||||
@empty
|
</tr>
|
||||||
<tr>
|
@empty
|
||||||
<td colspan="7" class="text-center">該当する駐輪場はありません。</td>
|
<tr>
|
||||||
</tr>
|
<td colspan="7" class="text-center">該当する駐輪場はありません。</td>
|
||||||
@endforelse
|
</tr>
|
||||||
</tbody>
|
@endforelse
|
||||||
</table>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
@php
|
@php
|
||||||
$totalPages = ceil($parks_table_total / $parks_table_perPage);
|
$totalPages = ceil($parks_table_total / $parks_table_perPage);
|
||||||
$currentPage = $parks_table_page;
|
$currentPage = $parks_table_page;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user