214 lines
10 KiB
PHP
214 lines
10 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', '[東京都|〇〇駐輪場] ゾーンマスタ')
|
|
|
|
@section('content')
|
|
<div class="content-header">
|
|
<div class="container-fluid">
|
|
<div class="row mb-2">
|
|
<div class="col-lg-6">
|
|
<h1 class="m-0 text-dark">ゾーンマスタ</h1>
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<ol class="breadcrumb float-sm-right text-sm">
|
|
<li class="breadcrumb-item"><a href="{{ route('home') }}">ホーム</a></li>
|
|
<li class="breadcrumb-item active">ゾーンマスタ</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<section class="content">
|
|
<!-- ▼ 絞り込みフィルター -->
|
|
<div class="col-lg-12">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h3 class="card-title">絞り込みフィルター</h3>
|
|
</div>
|
|
<div class="card-body">
|
|
<form action="{{ route('zones') }}" method="POST" id="list-form" class="form-horizontal">
|
|
@csrf
|
|
<input type="hidden" name="sort" value="{{ $sort ?? '' }}">
|
|
<input type="hidden" name="sort_type" value="{{ $sort_type ?? '' }}">
|
|
|
|
<table class="table table-borderless mb-0" style="width: 100%;">
|
|
<tbody>
|
|
<tr>
|
|
<th style="form-group col-2">駐輪場ID</th>
|
|
<td>
|
|
<select name="park_id" class="form-control form-control-sm" style="width: 300px;">
|
|
<option value="">全て</option>
|
|
@foreach($parkList as $id => $label)
|
|
<option value="{{ $id }}" {{ old('park_id', $park_id ?? '') == $id ? 'selected' : '' }}>
|
|
{{ $label }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
</td>
|
|
<th style="form-group col-2">駐輪分類ID</th>
|
|
<td>
|
|
<select name="ptype_id" class="form-control form-control-sm" style="width: 300px;">
|
|
<option value="">全て</option>
|
|
@foreach($ptypeList as $id => $label)
|
|
<option value="{{ $id }}" {{ old('ptype_id', $ptype_id ?? '') == $id ? 'selected' : '' }}>
|
|
{{ $label }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th style="form-group col-2">車種区分ID</th>
|
|
<td>
|
|
<select name="psection_id" class="form-control form-control-sm" style="width: 300px;">
|
|
<option value="">全て</option>
|
|
@foreach($psectionList as $id => $label)
|
|
<option value="{{ $id }}" {{ old('psection_id', $psection_id ?? '') == $id ? 'selected' : '' }}>
|
|
{{ $label }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
|
|
<div class="form-group col-12 text-left mt-3">
|
|
<button type="submit" name="action" value="filter" class="btn btn-default">絞り込み</button>
|
|
<button type="submit" name="action" value="reset" class="btn btn-default">解除</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- ▲ 絞り込みフィルター -->
|
|
|
|
<!-- ▼ ツールバー -->
|
|
<div class="container-fluid mb20">
|
|
<a href="{{ route('zones_add') }}" class="btn btn-sm btn-default mr10">新規</a>
|
|
<button type="submit" form="deleteForm" class="btn btn-sm btn-default mr10"
|
|
onclick="return confirm('選択したゾーンを削除しますか?');">削除</button>
|
|
<div class="d-flex justify-content-end">
|
|
{{ $zones->appends(request()->all())->links('pagination') }}
|
|
</div>
|
|
</div>
|
|
<!-- ▲ ツールバー -->
|
|
|
|
<!-- ▼ 一覧テーブル -->
|
|
<div class="col-lg-12 mb20">
|
|
<div class="table-responsive">
|
|
<form id="deleteForm" method="POST" action="{{ route('zones_delete') }}">
|
|
@csrf
|
|
<table class="table table-bordered dataTable text-nowrap">
|
|
<thead>
|
|
<tr>
|
|
<!-- 全選択チェックボックス -->
|
|
<th style="width:140px;" class="text-left">
|
|
<input type="checkbox" onclick="$('input[name*=\'pk\']').prop('checked', this.checked);">
|
|
</th>
|
|
|
|
<!-- ゾーンID -->
|
|
<th class="sorting {{ ($sort=='zone_id') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="zone_id">
|
|
<span>ゾーンID</span>
|
|
</th>
|
|
|
|
<!-- 駐輪場ID -->
|
|
<th class="sorting {{ ($sort=='park_id') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="park_id">
|
|
<span>駐輪場ID</span>
|
|
</th>
|
|
|
|
<!-- 駐輪分類ID -->
|
|
<th class="sorting {{ ($sort=='ptype_id') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="ptype_id">
|
|
<span>駐輪分類ID</span>
|
|
</th>
|
|
|
|
<!-- ゾーン名 -->
|
|
<th class="sorting {{ ($sort=='zone_name') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="zone_name">
|
|
<span>ゾーン名</span>
|
|
</th>
|
|
|
|
<!-- ゾーン内現在契約台数 -->
|
|
<th class="sorting {{ ($sort=='zone_number') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="zone_number">
|
|
<span>ゾーン内現在契約台数</span>
|
|
</th>
|
|
|
|
<!-- ゾーン内標準台数 -->
|
|
<th class="sorting {{ ($sort=='zone_standard') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="zone_standard">
|
|
<span>ゾーン内標準台数</span>
|
|
</th>
|
|
|
|
<!-- ゾーン内許容台数 -->
|
|
<th class="sorting {{ ($sort=='zone_tolerance') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="zone_tolerance">
|
|
<span>ゾーン内許容台数</span>
|
|
</th>
|
|
|
|
<!-- ゾーン順 -->
|
|
<th class="sorting {{ ($sort=='zone_sort') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="zone_sort">
|
|
<span>ゾーン順</span>
|
|
</th>
|
|
|
|
<!-- 車種区分ID -->
|
|
<th class="sorting {{ ($sort=='psection_id') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="psection_id">
|
|
<span>車種区分ID</span>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
@foreach($zones as $item)
|
|
<tr class="bg-white">
|
|
<td class="align-middle" style="background-color:#faebd7;">
|
|
<div class="d-flex align-items-center">
|
|
<input type="checkbox" class="m-0 checkbox" name="pk[]" value="{{ $item->zone_id }}">
|
|
<a href="{{ route('zones_edit', ['id' => $item->zone_id]) }}" class="btn btn-sm btn-default ml10">編集</a>
|
|
</div>
|
|
</td>
|
|
|
|
<td>{{ $item->zone_id }}</td>
|
|
<td>{{ $item->park_id }}</td>
|
|
<td>{{ $item->ptype_id }}</td>
|
|
<td>{{ $item->zone_name }}</td>
|
|
<td>{{ $item->zone_number }}</td>
|
|
<td>{{ $item->zone_standard }}</td>
|
|
<td>{{ $item->zone_tolerance }}</td>
|
|
<td>{{ $item->zone_sort }}</td>
|
|
<td>{{ $item->psection_id }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<!-- ▲ 一覧テーブル -->
|
|
</section>
|
|
|
|
@push('scripts')
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
// ---------------------
|
|
// ソート機能
|
|
// ---------------------
|
|
document.querySelectorAll('th.sorting').forEach(th => {
|
|
th.addEventListener('click', function() {
|
|
const form = document.getElementById('list-form');
|
|
const current = "{{ $sort ?? '' }}";
|
|
const currentType = "{{ $sort_type ?? '' }}";
|
|
const nextCol = this.getAttribute('sort');
|
|
let nextType = 'asc';
|
|
if (current === nextCol) {
|
|
nextType = (currentType === 'asc') ? 'desc' : 'asc';
|
|
}
|
|
form.querySelector('[name=sort]').value = nextCol;
|
|
form.querySelector('[name=sort_type]').value = nextType;
|
|
form.submit();
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
@endpush
|
|
|
|
@endsection
|