駐輪場所、料金マスタのソート機能の実装と画面表示の修正
All checks were successful
Deploy main / deploy (push) Successful in 26s
All checks were successful
Deploy main / deploy (push) Successful in 26s
This commit is contained in:
parent
1de2a0f022
commit
e8f9c35efb
@ -20,19 +20,23 @@ class PriceController extends Controller
|
|||||||
public function list(Request $request)
|
public function list(Request $request)
|
||||||
{
|
{
|
||||||
$inputs = [
|
$inputs = [
|
||||||
'isExport' => 0,
|
'isExport' => 0,
|
||||||
'sort' => $request->input('sort', ''),
|
'sort' => $request->input('sort', ''), // ソート対象カラム
|
||||||
'sort_type' => $request->input('sort_type', ''),
|
'sort_type' => $request->input('sort_type', ''), // 昇順/降順
|
||||||
'page' => $request->get('page', 1),
|
'page' => $request->get('page', 1),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Price::search 内で orderBy を反映させる
|
||||||
$inputs['list'] = Price::search($inputs);
|
$inputs['list'] = Price::search($inputs);
|
||||||
|
|
||||||
if ($inputs['list']->total() > 0 && $inputs['page'] > $inputs['list']->lastPage()) {
|
if ($inputs['list']->total() > 0 && $inputs['page'] > $inputs['list']->lastPage()) {
|
||||||
return redirect()->route('prices');
|
return redirect()->route('prices');
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('admin.prices.list', $inputs);
|
return view('admin.prices.list', $inputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function add(Request $request)
|
public function add(Request $request)
|
||||||
{
|
{
|
||||||
$inputs = [
|
$inputs = [
|
||||||
|
|||||||
@ -41,33 +41,36 @@ class Price extends Model
|
|||||||
|
|
||||||
public static function search($inputs)
|
public static function search($inputs)
|
||||||
{
|
{
|
||||||
$list = self::query();
|
$query = self::query();
|
||||||
// 只有在sort是有效字段时才排序
|
|
||||||
|
// 検索条件
|
||||||
$allowedSortColumns = [
|
$allowedSortColumns = [
|
||||||
'price_parkplaceid',
|
'price_parkplaceid', // 駐車場所ID
|
||||||
'prine_name',
|
'park_id', // 駐輪場ID
|
||||||
'price_month',
|
'prine_name', // 商品名
|
||||||
'park_id',
|
'price_month', // 期間
|
||||||
'psection_id',
|
'user_categoryid', // 利用者分類ID
|
||||||
'price_ptypeid',
|
'price', // 駐輪料金(税込)
|
||||||
'user_categoryid',
|
'psection_id', // 車種区分ID
|
||||||
'pplace_id',
|
'price_ptypeid', // 駐輪分類ID
|
||||||
'price'
|
'pplace_id', // 駐車車室ID
|
||||||
];
|
];
|
||||||
$sort_column = $inputs['sort'] ?? '';
|
|
||||||
$sort_type = strtolower($inputs['sort_type'] ?? 'asc');
|
// ソート指定
|
||||||
if (in_array($sort_column, $allowedSortColumns)) {
|
$sortColumn = $inputs['sort'] ?? '';
|
||||||
if (!in_array($sort_type, ['asc', 'desc'])) {
|
$sortType = strtolower($inputs['sort_type'] ?? 'asc');
|
||||||
$sort_type = 'asc';
|
|
||||||
|
if (in_array($sortColumn, $allowedSortColumns, true)) {
|
||||||
|
if (!in_array($sortType, ['asc', 'desc'], true)) {
|
||||||
|
$sortType = 'asc';
|
||||||
}
|
}
|
||||||
$list->orderBy($sort_column, $sort_type);
|
$query->orderBy($sortColumn, $sortType);
|
||||||
}
|
}
|
||||||
if ($inputs['isExport']) {
|
|
||||||
$list = $list->get();
|
// データ取得
|
||||||
} else {
|
return $inputs['isExport']
|
||||||
$list = $list->paginate(Utils::item_per_page);
|
? $query->get()
|
||||||
}
|
: $query->paginate(\App\Utils::item_per_page ?? 20);
|
||||||
return $list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,138 +6,155 @@
|
|||||||
@elseif(Session::has('error'))
|
@elseif(Session::has('error'))
|
||||||
<div class="alert alert-danger alert-dismissible">
|
<div class="alert alert-danger alert-dismissible">
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||||
<h4><i class="icon fa fa-ban"></i> {{__('誤差')}}:</h4>
|
<h4><i class="icon fa fa-ban"></i> {{ __('誤差') }}:</h4>
|
||||||
{!! Session::get('error') !!}
|
{!! Session::get('error') !!}
|
||||||
</div>
|
</div>
|
||||||
@elseif(isset($errorMsg))
|
@elseif(isset($errorMsg))
|
||||||
<div class="alert alert-danger alert-dismissible">
|
<div class="alert alert-danger alert-dismissible">
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||||
<h4><i class="icon fa fa-ban"></i> {{__('誤差')}}:</h4>
|
<h4><i class="icon fa fa-ban"></i> {{ __('誤差') }}:</h4>
|
||||||
{!! $errorMsg !!}
|
{!! $errorMsg !!}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<div class="card-header">
|
|
||||||
@if($isInfo)
|
|
||||||
<a href="{{route('price_add')}}" class="btn btn-lg btn-success">{{__('登録')}}</a>
|
|
||||||
<a href="{{route('price_edit',['id'=>$price_parkplaceid])}}" class="btn btn-lg btn-danger">{{__('編集')}}</a>
|
|
||||||
@else
|
|
||||||
<button type="submit" class="btn btn-lg btn-danger register" >{{__('登録')}}</button>
|
|
||||||
@endIf
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- 駐車場所ID -->
|
|
||||||
<div class="form-group col-3">
|
|
||||||
<label @if(!$isInfo) class="required" @endif>{{__('駐車場所ID')}}</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-9">
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" value="{{$price_parkplaceid}}" name="price_parkplaceid" class="form-control form-control-lg" @if($isInfo || $isEdit) readonly @endif/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 駐輪場ID -->
|
|
||||||
<div class="form-group col-3">
|
|
||||||
<label @if(!$isInfo) class="required" @endif>{{__('駐輪場ID')}}</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-9">
|
|
||||||
<div class="input-group">
|
|
||||||
<select name="park_id" class="form-control form-control-lg" @if($isInfo) disabled @endif>
|
|
||||||
<option value="">{{__('駐輪場ID')}}</option>
|
|
||||||
@foreach($parks as $key => $item)
|
|
||||||
<option value="{{$key}}" @if($key == $park_id) selected @endif>{{$item}}</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 商品名 -->
|
|
||||||
<div class="form-group col-3">
|
|
||||||
<label @if(!$isInfo) class="required" @endif>{{__('商品名')}}</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-9">
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" value="{{$prine_name}}" name="prine_name" class="form-control form-control-lg" @if($isInfo) readonly @endif/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 期間 -->
|
|
||||||
<div class="form-group col-3">
|
|
||||||
<label @if(!$isInfo) class="required" @endif>{{__('期間')}}</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-9">
|
|
||||||
<div class="input-group">
|
|
||||||
<select name="price_month" class="form-control form-control-lg" @if($isInfo) disabled @endif>
|
|
||||||
<option value="">{{__('期間')}}</option>
|
|
||||||
@foreach(\App\Models\Price::PRICE_MONTH as $key => $item)
|
|
||||||
<option value="{{$key}}" @if($key == $price_month) selected @endif>{{$item}}</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 利用者分類ID -->
|
|
||||||
<div class="form-group col-3">
|
|
||||||
<label @if(!$isInfo) class="required" @endif>{{__('利用者分類ID')}}</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-9">
|
|
||||||
<div class="input-group">
|
|
||||||
<select name="user_categoryid" class="form-control form-control-lg" @if($isInfo) disabled @endif>
|
|
||||||
<option value="">{{__('利用者分類ID')}}</option>
|
|
||||||
@foreach($userTypes as $key => $item)
|
|
||||||
<option value="{{$key}}" @if($key == $user_categoryid) selected @endif>{{$item}}</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 駐輪料金(税込) -->
|
|
||||||
<div class="form-group col-3">
|
|
||||||
<label @if(!$isInfo) class="required" @endif>{{__('駐輪料金(税込)')}}</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-9">
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" value="{{$price}}" name="price" class="form-control form-control-lg" @if($isInfo) readonly @endif/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 車種区分ID -->
|
|
||||||
<div class="form-group col-3">
|
|
||||||
<label @if(!$isInfo) class="required" @endif>{{__('車種区分ID')}}</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-9">
|
|
||||||
<div class="input-group">
|
|
||||||
<select name="psection_id" class="form-control form-control-lg" @if($isInfo) disabled @endif>
|
|
||||||
<option value="">{{__('車種区分ID')}}</option>
|
|
||||||
@foreach($psections as $key => $item)
|
|
||||||
<option value="{{$key}}" @if($key == $psection_id) selected @endif>{{$item}}</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 駐輪分類ID -->
|
|
||||||
<div class="form-group col-3">
|
|
||||||
<label @if(!$isInfo) class="required" @endif>{{__('駐輪分類ID')}}</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-9">
|
|
||||||
<div class="input-group">
|
|
||||||
<select name="price_ptypeid" class="form-control form-control-lg" @if($isInfo) disabled @endif>
|
|
||||||
<option value="">{{__('駐輪分類ID')}}</option>
|
|
||||||
@foreach($ptypes as $key => $item)
|
|
||||||
<option value="{{$key}}" @if($key == $price_ptypeid) selected @endif>{{$item}}</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 駐車車室ID -->
|
|
||||||
<div class="form-group col-3">
|
|
||||||
<label @if(!$isInfo) class="required" @endif>{{__('駐車車室ID')}}</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-9">
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" value="{{$pplace_id}}" name="pplace_id" class="form-control form-control-lg" @if($isInfo) readonly @endif/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@if($isInfo)
|
|
||||||
<a href="{{route('price_add')}}" class="btn btn-lg btn-success">{{__('登録')}}</a>
|
|
||||||
<a href="{{route('price_edit',['id'=>$price_parkplaceid])}}" class="btn btn-lg btn-danger">{{__('編集')}}</a>
|
|
||||||
@else
|
|
||||||
<button type="submit" class="btn btn-lg btn-danger register" >{{__('登録')}}</button>
|
|
||||||
@endIf
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
@if($isEdit)
|
||||||
|
<!-- 駐車場所ID -->
|
||||||
|
<div class="col-3">
|
||||||
|
<label class="required">{{ __('駐車場所ID') }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-9">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" value="{{ $price_parkplaceid }}" name="price_parkplaceid"
|
||||||
|
class="form-control form-control-lg" readonly />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<!-- 商品名 -->
|
||||||
|
<div class="form-group col-3">
|
||||||
|
<label class="required">{{ __('商品名') }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-9">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" value="{{ $prine_name }}" name="prine_name"
|
||||||
|
class="form-control form-control-lg" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 期間 -->
|
||||||
|
<div class="form-group col-3">
|
||||||
|
<label class="required">{{ __('期間') }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-9">
|
||||||
|
<div class="input-group">
|
||||||
|
<select name="price_month" class="form-control form-control-lg">
|
||||||
|
<option value="">{{ __('期間') }}</option>
|
||||||
|
@foreach(\App\Models\Price::PRICE_MONTH as $key => $item)
|
||||||
|
<option value="{{ $key }}" @if($key == $price_month) selected @endif>{{ $item }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 駐輪場ID -->
|
||||||
|
<div class="form-group col-3">
|
||||||
|
<label class="required">{{ __('駐輪場名') }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-9">
|
||||||
|
<div class="input-group">
|
||||||
|
<select name="park_id" class="form-control form-control-lg">
|
||||||
|
<option value="">{{ __('駐輪場名') }}</option>
|
||||||
|
@foreach($parks as $key => $item)
|
||||||
|
<option value="{{ $key }}" @if($key == $park_id) selected @endif>{{ $item }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 車種区分名 -->
|
||||||
|
<div class="form-group col-3">
|
||||||
|
<label class="required">{{ __('車種区分名') }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-9">
|
||||||
|
<div class="input-group">
|
||||||
|
<select name="psection_id" class="form-control form-control-lg">
|
||||||
|
<option value="">{{ __('車種区分名') }}</option>
|
||||||
|
@foreach($psections as $key => $item)
|
||||||
|
<option value="{{ $key }}" @if($key == $psection_id) selected @endif>{{ $item }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 駐輪分類名 -->
|
||||||
|
<div class="form-group col-3">
|
||||||
|
<label class="required">{{ __('駐輪分類名') }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-9">
|
||||||
|
<div class="input-group">
|
||||||
|
<select name="price_ptypeid" class="form-control form-control-lg">
|
||||||
|
<option value="">{{ __('駐輪分類名') }}</option>
|
||||||
|
@foreach($ptypes as $key => $item)
|
||||||
|
<option value="{{ $key }}" @if($key == $price_ptypeid) selected @endif>{{ $item }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 利用者分類 -->
|
||||||
|
<div class="form-group col-3">
|
||||||
|
<label class="required">{{ __('利用者分類') }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-9">
|
||||||
|
<div class="input-group">
|
||||||
|
<select name="user_categoryid" class="form-control form-control-lg">
|
||||||
|
<option value="">{{ __('利用者分類') }}</option>
|
||||||
|
@foreach($userTypes as $key => $item)
|
||||||
|
<option value="{{ $key }}" @if($key == $user_categoryid) selected @endif>{{ $item }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 駐車車室ID -->
|
||||||
|
<div class="col-3">
|
||||||
|
<label class="required">{{ __('駐車車室ID') }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-9">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" value="{{ $pplace_id }}" name="pplace_id"
|
||||||
|
class="form-control form-control-lg" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 駐輪料金(税込) -->
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-3 col-form-label required">{{ __('駐輪料金(税込)') }}</label>
|
||||||
|
<div class="col-9">
|
||||||
|
<input type="text" value="{{ $price }}" name="price"
|
||||||
|
class="form-control form-control-lg" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{{-- 下部ボタン --}}
|
||||||
|
@if($isEdit)
|
||||||
|
{{-- 編集画面 --}}
|
||||||
|
<button type="submit" class="btn btn-lg btn-success">{{ __('登録') }}</button>
|
||||||
|
|
||||||
|
<form method="POST" action="{{ route('prices_delete', ['id' => $price_parkplaceid]) }}" class="d-inline">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<button type="submit" class="btn btn-lg btn-danger">{{ __('削除') }}</button>
|
||||||
|
</form>
|
||||||
|
@else
|
||||||
|
{{-- 新規画面 --}}
|
||||||
|
<button type="submit" class="btn btn-lg btn-success">{{ __('登録') }}</button>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<!-- /.card-body -->
|
||||||
@ -1,28 +1,37 @@
|
|||||||
|
|
||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
@section('title', '[東京都|〇〇駐輪場] 駐輪場所、料金マスタ')
|
@section('title', '駐輪場所、料金マスタ')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<!-- Main content -->
|
<div class="content-header">
|
||||||
<section class="content">
|
<div class="container-fluid">
|
||||||
<div class="container-fluid">
|
<div class="row mb-2">
|
||||||
<!-- SELECT2 EXAMPLE -->
|
<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"><a href="{{ route('prices') }}">駐輪場所、料金マスタ</a></li>
|
||||||
|
<li class="breadcrumb-item active">編集</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<section class="content">
|
||||||
<div class="col-lg-12">
|
<div class="container-fluid">
|
||||||
<div class="card">
|
<div class="row">
|
||||||
<form method="post" action="{{ route('price_edit',['id'=>$price_parkplaceid])}}" enctype="multipart/form-data">
|
<div class="col-lg-12">
|
||||||
<!-- TOKEN FORM -->
|
<div class="card">
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token() }}" >
|
<form method="POST" action="{{ route('price_edit', ['id' => $price_parkplaceid]) }}" enctype="multipart/form-data">
|
||||||
<!-- / .TOKEN FORM -->
|
@csrf
|
||||||
@include('admin.prices._form',['isEdit'=>1,'isInfo'=>0])
|
@method('PUT')
|
||||||
</form>
|
@include('admin.prices._form', ['isEdit' => true])
|
||||||
</div>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</div>
|
||||||
<!-- /.content -->
|
</section>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@ -11,8 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<ol class="breadcrumb float-sm-right text-sm">
|
<ol class="breadcrumb float-sm-right text-sm">
|
||||||
<li class="breadcrumb-item"><a href="{{route('home')}}">XX様info(ホーム)</a></li>
|
<li class="breadcrumb-item"><a href="{{route('home')}}">ホーム</a></li>
|
||||||
<li class="breadcrumb-item"><a href="javascript: void(0);">[東京都|〇〇駐輪場]</a></li>
|
|
||||||
<li class="breadcrumb-item active">{{__('駐輪場所、料金マスタ')}}</li>
|
<li class="breadcrumb-item active">{{__('駐輪場所、料金マスタ')}}</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
@ -23,26 +22,31 @@
|
|||||||
{{-- ▼ メインコンテンツ --}}
|
{{-- ▼ メインコンテンツ --}}
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
{{-- 並び替え用 hidden --}}
|
||||||
|
<form action="{{ route('prices') }}" method="POST" id="list-form">
|
||||||
|
@csrf
|
||||||
|
<input type="hidden" name="sort" value="{{ $sort ?? '' }}">
|
||||||
|
<input type="hidden" name="sort_type" value="{{ $sort_type ?? '' }}">
|
||||||
|
</form>
|
||||||
|
|
||||||
{{-- ▼ ボタン列(新規/削除/CSV出力/インポート/エクスポート) --}}
|
{{-- ▼ 各種アクションボタン群 --}}
|
||||||
<div class="container-fluid mb20">
|
<div class="container-fluid mb20">
|
||||||
<button type="button" class="btn btn-sm btn-primary mr10"
|
<button type="button" class="btn btn-sm btn-default mr10"
|
||||||
onclick="location.href='{{ route('price_add') }}'">新規</button>
|
onclick="location.href='{{ route('price_add') }}'">新規</button>
|
||||||
<button type="submit" class="btn btn-sm btn-danger mr10" form="form_delete" name="delete" id="delete"
|
<button type="submit" class="btn btn-sm btn-default mr10" form="form_delete" name="delete" id="delete"
|
||||||
onclick="return confirm('選択した項目を削除しますか?');">削除</button>
|
onclick="return confirm('選択した項目を削除しますか?');">削除</button>
|
||||||
<button type="submit" class="btn btn-sm btn-success mr10" name="export_csv" id="export_csv"
|
<button type="submit" class="btn btn-sm btn-default mr10" name="export_csv" id="export_csv"
|
||||||
action="{{route('prices_export')}}">CSV出力</button>
|
action="{{route('prices_export')}}">CSV出力</button>
|
||||||
<button type="submit" class="btn btn-sm btn-info mr10" name="import_csv" id="import_csv"
|
<button type="submit" class="btn btn-sm btn-default mr10" name="import_csv" id="import_csv"
|
||||||
action="{{route('prices_import')}}">インポート</button>
|
action="{{route('prices_import')}}">インポート</button>
|
||||||
<button type="button" class="btn btn-sm btn-info mr10"
|
<button type="button" class="btn btn-sm btn-default mr10"
|
||||||
onclick="location.href='{{ route('prices_export') }}'">エクスポート</button>
|
onclick="location.href='{{ route('prices_export') }}'">エクスポート</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- ▼ ページネーション(上部・右寄せ) --}}
|
<div class="d-flex justify-content-end">
|
||||||
<div style="width:100%; text-align: right;">
|
{{ $list->appends(['sort' => $sort ?? '', 'sort_type' => $sort_type ?? ''])->links('pagination') }}
|
||||||
{{ $list->appends(['sort' => $sort, 'sort_type' => $sort_type])->links('pagination') }}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- ▼ フラッシュメッセージ --}}
|
{{-- ▼ フラッシュメッセージ --}}
|
||||||
<div class="form col-lg-12">
|
<div class="form col-lg-12">
|
||||||
@if(Session::has('success'))
|
@if(Session::has('success'))
|
||||||
@ -68,58 +72,77 @@
|
|||||||
{{-- ▼ 一覧(市区マスタ準拠:1枚テーブル/先頭が「チェック+編集」統合列) --}}
|
{{-- ▼ 一覧(市区マスタ準拠:1枚テーブル/先頭が「チェック+編集」統合列) --}}
|
||||||
<form action="{{route('prices_delete')}}" method="post" id="form_delete">
|
<form action="{{route('prices_delete')}}" method="post" id="form_delete">
|
||||||
@csrf
|
@csrf
|
||||||
<div class="table-responsive">
|
<!-- ▼ ここから単一テーブル構成 ----------------------------------------- -->
|
||||||
<table class="table table-bordered table-hover" style="min-width:1000px;">
|
<div class="col-lg-12 mb20">
|
||||||
<thead class="thead-light">
|
<div class="table-responsive">
|
||||||
<tr>
|
<form action="{{ route('prices_delete') }}" method="POST" id="form_delete">
|
||||||
{{-- 統合列:全選択チェック + 編集(背景 #faebd7) --}}
|
@csrf
|
||||||
<th style="width:160px;">
|
<table class="table table-bordered dataTable text-nowrap">
|
||||||
<input type="checkbox" id="checkbox_all" >
|
<thead class="thead-light">
|
||||||
<span class="text-muted" style="font-weight:normal;"></span>
|
<tr>
|
||||||
</th>
|
{{-- ★ チェック + 編集 用の1列 --}}
|
||||||
{{-- データ列(見出しはそのまま) --}}
|
<th style="width:140px;" class="text-left">
|
||||||
<th><span>駐車場所ID</span></th>
|
<input type="checkbox" onclick="$('input[name*=\'pk\']').prop('checked', this.checked);">
|
||||||
<th><span>駐輪場ID</span></th>
|
</th>
|
||||||
<th><span>商品名</span></th>
|
|
||||||
<th><span>期間</span></th>
|
|
||||||
<th><span>利用者分類ID</span></th>
|
|
||||||
<th><span>駐輪料金(税込)</span></th>
|
|
||||||
<th><span>車種区分ID</span></th>
|
|
||||||
<th><span>駐輪分類ID</span></th>
|
|
||||||
<th><span>駐車車室ID</span></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach($list as $item)
|
|
||||||
<tr>
|
|
||||||
{{-- ▼ 統合セル:チェック + 編集(pk[]/背景 #faebd7/間隔は ml-2) --}}
|
|
||||||
<td style="background:#faebd7;">
|
|
||||||
<input type="checkbox" name="pk[]"
|
|
||||||
value="{{$item->price_parkplaceid}}">
|
|
||||||
<a href="{{route('price_info', ['id' => $item->price_parkplaceid])}}"
|
|
||||||
class="btn btn-sm btn-default ml10">{{__('編集')}}</a>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
{{-- ▼ データ本体(既存表示そのまま) --}}
|
{{-- ▼ ソート対象列 --}}
|
||||||
<td class='sm-item text-left'><span>{{ mb_substr($item->price_parkplaceid, 0, 10) }}</span></td>
|
<th class="sorting {{ ($sort=='price_parkplaceid') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="price_parkplaceid">
|
||||||
<td class='sm-item text-right'><span>{{ mb_substr($item->park_id, 0, 10) }}</span></td>
|
<span>駐輪場所ID</span>
|
||||||
<td class='sm-item text-right'><span>{{ mb_substr($item->prine_name, 0, 10) }}</span></td>
|
</th>
|
||||||
<td class='sm-item text-right'><span>{{ mb_substr($item->price_month, 0, 10) }}</span></td>
|
<th class="sorting {{ ($sort=='park_id') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="park_id">
|
||||||
<td class='sm-item text-right'><span>{{ mb_substr($item->user_categoryid, 0, 10) }}</span></td>
|
<span>駐輪場ID</span>
|
||||||
<td class='sm-item text-right'><span>{{ mb_substr($item->price, 0, 10) }}</span></td>
|
</th>
|
||||||
<td class='sm-item text-right'><span>{{ mb_substr($item->psection_id, 0, 10) }}</span></td>
|
|
||||||
<td class='sm-item text-right'><span>{{ mb_substr($item->price_ptypeid, 0, 10) }}</span></td>
|
|
||||||
<td class='sm-item text-right'><span>{{ mb_substr($item->pplace_id, 0, 10) }}</span></td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- ▼ ページネーション(下部・右寄せ:必要に応じて表示) --}}
|
{{-- ▼ ソート不要 --}}
|
||||||
<div class="mt-3" style="text-align:right;">
|
<th><span>商品名</span></th>
|
||||||
{{ $list->appends(['sort' => $sort, 'sort_type' => $sort_type])->links('pagination') }}
|
<th><span>期間</span></th>
|
||||||
|
<th><span>利用者分類ID</span></th>
|
||||||
|
<th><span>駐輪料金(税込)</span></th>
|
||||||
|
|
||||||
|
{{-- ▼ ソート対象列 --}}
|
||||||
|
<th class="sorting {{ ($sort=='psection_id') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="psection_id">
|
||||||
|
<span>車種区分ID</span>
|
||||||
|
</th>
|
||||||
|
<th class="sorting {{ ($sort=='price_ptypeid') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="price_ptypeid">
|
||||||
|
<span>駐輪分類</span>
|
||||||
|
</th>
|
||||||
|
<th class="sorting {{ ($sort=='pplace_id') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="pplace_id">
|
||||||
|
<span>駐車車室ID</span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody class="bg-white">
|
||||||
|
@foreach($list as $item)
|
||||||
|
<tr>
|
||||||
|
{{-- ★ 同じセル内に チェック + 編集ボタン --}}
|
||||||
|
<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->price_parkplaceid }}">
|
||||||
|
<a href="{{ route('price_edit', ['id' => $item->price_parkplaceid]) }}" class="btn btn-sm btn-default ml10">編集</a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{{-- データ列 --}}
|
||||||
|
<td class="sm-item text-left align-middle">{{ $item->price_parkplaceid }}</td>
|
||||||
|
<td class="sm-item text-left align-middle">{{ $item->park_id }}</td>
|
||||||
|
<td class="sm-item text-left align-middle">{{ $item->prine_name }}</td>
|
||||||
|
<td class="sm-item text-left align-middle">{{ $item->price_month }}</td>
|
||||||
|
<td class="sm-item text-left align-middle">{{ $item->user_categoryid }}</td>
|
||||||
|
<td class="sm-item text-left align-middle">{{ $item->price }}</td>
|
||||||
|
<td class="sm-item text-left align-middle">{{ $item->psection_id }}</td>
|
||||||
|
<td class="sm-item text-left align-middle">{{ $item->price_ptypeid }}</td>
|
||||||
|
<td class="sm-item text-left align-middle">{{ $item->pplace_id }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- ▲ 単一テーブル構成ここまで ----------------------------------------- -->
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@ -133,3 +156,23 @@ document.getElementById('checkbox_all')?.addEventListener('change', function(e){
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
@section('scripts')
|
||||||
|
<script>
|
||||||
|
$(function(){
|
||||||
|
$('.sorting').click(function(){
|
||||||
|
let sort = $(this).attr('sort');
|
||||||
|
let currentSort = $('input[name="sort"]').val();
|
||||||
|
let currentType = $('input[name="sort_type"]').val();
|
||||||
|
let newType = 'asc';
|
||||||
|
|
||||||
|
if (sort === currentSort) {
|
||||||
|
newType = (currentType === 'asc') ? 'desc' : 'asc';
|
||||||
|
}
|
||||||
|
$('input[name="sort"]').val(sort);
|
||||||
|
$('input[name="sort_type"]').val(newType);
|
||||||
|
$('#list-form').submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endsection
|
||||||
@ -35,6 +35,8 @@
|
|||||||
<link rel="stylesheet" href="{{ asset('assets/css/style.css') }}">
|
<link rel="stylesheet" href="{{ asset('assets/css/style.css') }}">
|
||||||
<!-- Styles -->
|
<!-- Styles -->
|
||||||
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
|
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
|
||||||
|
<!-- kin 追加 -->
|
||||||
|
<link href="{{ asset('assets/css/app.css') }}" rel="stylesheet">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user