【減免確認マスタ】ページネーション追加
All checks were successful
Deploy main / deploy (push) Successful in 22s

This commit is contained in:
OU.ZAIKOU 2026-02-01 03:02:59 +09:00
parent 0a5e21cd9a
commit b22cc34379
3 changed files with 64 additions and 61 deletions

View File

@ -31,7 +31,7 @@
{{-- ボタンエリア(上部) --}}
<div class="mt-2">
<button type="button" class="btn btn-default mt-2 btn-submit">登録</button>
<a href="{{ route('reduction_confirm.index', ['park_id' => $park->park_id]) }}" class="btn btn-default mt-2">
<a href="{{ route('reduction_confirm.list', ['park_id' => $park->park_id]) }}" class="btn btn-default mt-2">
減免確認編集
</a>
<a href="javascript:void(0)" class="btn btn-default mt-2">駐輪状況編集</a>

View File

@ -3,10 +3,12 @@
// reduction_confirm テーブルから取得したレコード
$userCategoryId = $row->user_categoryid;
$checkType = $row->reduction_confirm_type;
$oldCheckType = old("reduction_confirm_type.$userCategoryId", $checkType);
// use numeric index passed from parent to avoid name collisions when duplicate user_categoryid exist
$idx = $index ?? ($userCategoryId);
$oldCheckType = old("reduction_confirm_type.$idx", $checkType);
// 学生分類かどうかを判定
$isStudent = $row->usertype_subject1 === '学生';
$isStudent = ($row->usertype_subject1 ?? '') === '学生';
$rowClass = $isStudent ? 'table-secondary' : '';
$isDisabled = $isStudent;
@endphp
@ -17,45 +19,47 @@
<td>{{ $row->usertype_subject2 ?? '-' }}</td>
<td>{{ $row->usertype_subject3 ?? '-' }}</td>
<td>
{{-- hidden mapping to know which user_categoryid this input row targets --}}
<input type="hidden" name="row_user_categoryid[{{ $idx }}]" value="{{ $userCategoryId }}">
<div class="d-flex justify-content-center gap-3">
{{-- 確認しない0 --}}
<div class="custom-control custom-radio">
<input type="radio"
id="check_type_{{ $userCategoryId }}_0"
name="reduction_confirm_type[{{ $userCategoryId }}]"
<input type="radio"
id="check_type_{{ $idx }}_0"
name="reduction_confirm_type[{{ $idx }}]"
value="0"
class="custom-control-input"
@checked($oldCheckType == 0)
@disabled($isDisabled)>
<label class="custom-control-label" for="check_type_{{ $userCategoryId }}_0">
<label class="custom-control-label" for="check_type_{{ $idx }}_0">
確認しない
</label>
</div>
{{-- 年1回1 --}}
<div class="custom-control custom-radio">
<input type="radio"
id="check_type_{{ $userCategoryId }}_1"
name="reduction_confirm_type[{{ $userCategoryId }}]"
<input type="radio"
id="check_type_{{ $idx }}_1"
name="reduction_confirm_type[{{ $idx }}]"
value="1"
class="custom-control-input"
@checked($oldCheckType == 1)
@disabled($isDisabled)>
<label class="custom-control-label" for="check_type_{{ $userCategoryId }}_1">
<label class="custom-control-label" for="check_type_{{ $idx }}_1">
年1回
</label>
</div>
{{-- 毎更新時2 --}}
<div class="custom-control custom-radio">
<input type="radio"
id="check_type_{{ $userCategoryId }}_2"
name="reduction_confirm_type[{{ $userCategoryId }}]"
<input type="radio"
id="check_type_{{ $idx }}_2"
name="reduction_confirm_type[{{ $idx }}]"
value="2"
class="custom-control-input"
@checked($oldCheckType == 2)
@disabled($isDisabled)>
<label class="custom-control-label" for="check_type_{{ $userCategoryId }}_2">
<label class="custom-control-label" for="check_type_{{ $idx }}_2">
毎更新時
</label>
</div>

View File

@ -69,56 +69,54 @@
</div>
{{--
<div class="text-right mb-2">
{{ $list->total() }} 件中 {{ $list->firstItem() }}{{ $list->lastItem() }} 件を表示
</div>
<div class="ml-auto">
{{ $list->appends(keepUserListQuery())->links('pagination') }}
</div>
--}}
</div>
<!-- 減免確認マスタ テーブル -->
<div class="col-lg-12 px-0 ">
<form action="{{ route('reduction_confirm.store') }}" method="POST" id="reduction-form">
{{-- 登録ボタン --}}
<div class="container-fluid mb20">
<button type="submit" class="btn btn-primary mt-2 btn-submit">登録</button>
</div>
<div class="d-flex justify-content-between align-items-center mb-2">
{{-- 左側:登録ボタン --}}
<button type="submit" class="btn btn-primary btn-submit">登録</button>
@csrf
<input type="hidden" name="park_id" value="{{ $parkId }}">
<div class="table-responsive">
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th style="width: 5%; text-align: center;">利用者分類</th>
<th style="width: 10%;">分類名1</th>
<th style="width: 10%;">分類名2</th>
<th style="width: 10%;">分類名3</th>
<th style="width: 20%; text-align: center;">減免確認種別</th>
</tr>
</thead>
<tbody>
@forelse ($reductionData as $row)
@include('admin.reduction_confirm._form', ['row' => $row])
@empty
<tr>
<td colspan="5" class="text-center text-muted">
利用者分類がありません。
</td>
</tr>
@endforelse
</tbody>
</table>
{{-- 右側:件数 + ページネーション --}}
<div class="text-right">
<div>
{{ $reductionData->total() }} 件中
{{ $reductionData->firstItem() }}{{ $reductionData->lastItem() }} 件を表示
</div>
<div>
{{ $reductionData->appends(keepUserListQuery())->links('pagination') }}
</div>
</div>
</div>
</form>
</div>
@csrf
<input type="hidden" name="park_id" value="{{ $parkId }}">
<div class="table-responsive">
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th style="width: 5%; text-align: center;">利用者分類</th>
<th style="width: 10%;">分類名1</th>
<th style="width: 10%;">分類名2</th>
<th style="width: 10%;">分類名3</th>
<th style="width: 20%; text-align: center;">減免確認種別</th>
</tr>
</thead>
<tbody>
@forelse ($reductionData as $row)
@include('admin.reduction_confirm._form', ['row' => $row, 'index' => $loop->index])
@empty
<tr>
<td colspan="5" class="text-center text-muted">
利用者分類がありません。
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</form>
</div>
</section>
<style>
@ -145,8 +143,9 @@
width: fit-content;
min-width: 320px;
}
.sample03-wrapper {
background-color: white;
}
.sample03-wrapper {
background-color: white;
}
</style>
@endsection