This commit is contained in:
parent
9df0d9c2c5
commit
7fc3c33bed
@ -61,7 +61,7 @@ class RegularTypeController extends Controller
|
|||||||
$new->save();
|
$new->save();
|
||||||
});
|
});
|
||||||
|
|
||||||
$request->session()->flash('success', __('新しい成功を創造する。'));
|
$request->session()->flash('success', __('登録に成功しました。'));
|
||||||
return redirect()->route('regular_types');
|
return redirect()->route('regular_types');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,15 @@ class RegularTypeController extends Controller
|
|||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array_merge($regular_type->getAttributes(), $this->getDataDropList());
|
$data = array_merge(
|
||||||
|
$regular_type->getAttributes(),
|
||||||
|
$this->getDataDropList(),
|
||||||
|
[
|
||||||
|
'regular_type' => $regular_type,
|
||||||
|
'isEdit' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
if ($request->isMethod('POST')) {
|
if ($request->isMethod('POST')) {
|
||||||
|
|
||||||
@ -129,18 +137,26 @@ class RegularTypeController extends Controller
|
|||||||
|
|
||||||
public function delete(Request $request)
|
public function delete(Request $request)
|
||||||
{
|
{
|
||||||
$arr_pk = $request->get('pk');
|
$arr_pk = $request->get('pk'); // 配列で受け取る
|
||||||
|
|
||||||
if ($arr_pk) {
|
if ($arr_pk) {
|
||||||
if (RegularType::deleteByPk($arr_pk)) {
|
$deleted = RegularType::destroy($arr_pk);
|
||||||
return redirect()->route('regular_types')->with('success', __("削除が完了しました。"));
|
|
||||||
|
if ($deleted > 0) {
|
||||||
|
return redirect()->route('regular_types')
|
||||||
|
->with('success', __("削除が完了しました。"));
|
||||||
} else {
|
} else {
|
||||||
return redirect()->route('regular_types')->with('error', __('削除に失敗しました。'));
|
return redirect()->route('regular_types')
|
||||||
|
->with('error', __('削除に失敗しました。'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return redirect()->route('regular_types')->with('error', __('削除するユーザーを選択してください。'));
|
|
||||||
|
return redirect()->route('regular_types')
|
||||||
|
->with('error', __('削除するデータを選択してください。'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function export(Request $request)
|
public function export(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -38,8 +38,8 @@ class StationController extends Controller
|
|||||||
'station_route_name',
|
'station_route_name',
|
||||||
'park_id',
|
'park_id',
|
||||||
'operator_id',
|
'operator_id',
|
||||||
'station_latitude',
|
// 'station_latitude', 追加予定
|
||||||
'station_longitude',
|
// 'station_longitude', 追加予定
|
||||||
])
|
])
|
||||||
->orderBy($sort, $sort_type)
|
->orderBy($sort, $sort_type)
|
||||||
->paginate(20);
|
->paginate(20);
|
||||||
|
|||||||
@ -14,14 +14,14 @@ class RegularTypeRequest extends FormRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => 'required|string|max:255',
|
'city_id' => 'required|string|max:255',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function messages()
|
public function messages()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name.required' => '市区名は必須です。',
|
'city_id.required' => '市区名は必須です。',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,30 +19,47 @@
|
|||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@if($isEdit || $isInfo)
|
|
||||||
<!-- 定期種別ID -->
|
{{-- バリデーションエラー表示 --}}
|
||||||
<div class="form-group col-3">
|
@if ($errors->any())
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<ul class="mb-0">
|
||||||
|
@foreach ($errors->all() as $error)
|
||||||
|
<li>{{ $error }}</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<!-- 定期種別ID(自動採番) -->
|
||||||
|
<div class="col-3">
|
||||||
<label>{{ __('定期種別ID') }}</label>
|
<label>{{ __('定期種別ID') }}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-9">
|
<div class="form-group col-9">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" value="{{$regular_type_id}}"
|
<input type="text" name="regular_type_id"
|
||||||
placeholder="{{__('validation.attributes.regular_type_id')}}"
|
class="form-control text-right bg-light"
|
||||||
class="form-control form-control-lg" readonly/>
|
value="{{ old('regular_type_id', $regular_type_id ?? '') }}"
|
||||||
|
maxlength="10" readonly>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.form group - 定期種別ID -->
|
|
||||||
@endIf
|
|
||||||
|
|
||||||
<!-- 市区名 -->
|
<!-- 市区名 -->
|
||||||
<div class="form-group col-3">
|
<div class="form-group col-3">
|
||||||
<label @if(!$isInfo) class="required" @endif>{{__('市区名')}}</label>
|
<label class="form-label">
|
||||||
|
{{ __('市区名') }}
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-9">
|
<div class="form-group col-9">
|
||||||
<select class="form-control form-control-lg mb10" name="city_id" @if($isInfo) disabled @endif>
|
<select class="form-control form-control-lg mb10"
|
||||||
|
name="city_id"
|
||||||
|
@if($isEdit) @else required @endif>
|
||||||
<option value="">{{ __('市区名') }}</option>
|
<option value="">{{ __('市区名') }}</option>
|
||||||
@foreach($cities as $key => $val)
|
@foreach($cities as $key => $val)
|
||||||
<option value="{{$key}}" @if($city_id == $key) selected @endif>{{$val}}</option>
|
<option value="{{ $key }}" @if($city_id == $key) selected @endif>
|
||||||
|
{{ $val }}
|
||||||
|
</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -55,19 +72,19 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-2 offset-1 form-check">
|
<div class="col-2 offset-1 form-check">
|
||||||
<input type="radio" class="minimal"
|
<input type="radio" class="minimal"
|
||||||
name="regular_class_1" @if($isInfo) disabled @endif
|
name="regular_class_1"
|
||||||
value="1" {{$regular_class_1? 'checked':''}}>
|
value="1" @if(isset($regular_class_1) && $regular_class_1 == 1) checked @endif>
|
||||||
<label class="form-check-label">{{ __("有効") }}</label>
|
<label class="form-check-label">{{ __("有効") }}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2 form-check">
|
<div class="col-2 form-check">
|
||||||
<input type="radio" class="minimal"
|
<input type="radio" class="minimal"
|
||||||
name="regular_class_1" @if($isInfo) disabled @endif
|
name="regular_class_1"
|
||||||
value="0" {{!$regular_class_1? 'checked':''}}>
|
value="0" @if(isset($regular_class_1) && $regular_class_1 === 0) checked @endif>
|
||||||
<label class="form-check-label">{{ __("無効") }}</label>
|
<label class="form-check-label">{{ __("無効") }}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.form group - 定期種別1 -->
|
|
||||||
|
|
||||||
<!-- 定期種別2 -->
|
<!-- 定期種別2 -->
|
||||||
<div class="form-group col-3">
|
<div class="form-group col-3">
|
||||||
@ -77,19 +94,18 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-2 offset-1 form-check">
|
<div class="col-2 offset-1 form-check">
|
||||||
<input type="radio" class="minimal"
|
<input type="radio" class="minimal"
|
||||||
name="regular_class_2" @if($isInfo) disabled @endif
|
name="regular_class_2"
|
||||||
value="1" {{$regular_class_2? 'checked':''}}>
|
value="1" @if(isset($regular_class_2) && $regular_class_2 == 1) checked @endif>
|
||||||
<label class="form-check-label">{{ __("有効") }}</label>
|
<label class="form-check-label">{{ __("有効") }}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2 form-check">
|
<div class="col-2 form-check">
|
||||||
<input type="radio" class="minimal"
|
<input type="radio" class="minimal"
|
||||||
name="regular_class_2" @if($isInfo) disabled @endif
|
name="regular_class_2"
|
||||||
value="0" {{!$regular_class_2? 'checked':''}}>
|
value="0" @if(isset($regular_class_2) && $regular_class_2 === 0) checked @endif>
|
||||||
<label class="form-check-label">{{ __("無効") }}</label>
|
<label class="form-check-label">{{ __("無効") }}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.form group - 定期種別2 -->
|
|
||||||
|
|
||||||
<!-- 定期種別3 -->
|
<!-- 定期種別3 -->
|
||||||
<div class="form-group col-3">
|
<div class="form-group col-3">
|
||||||
@ -99,19 +115,18 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-2 offset-1 form-check">
|
<div class="col-2 offset-1 form-check">
|
||||||
<input type="radio" class="minimal"
|
<input type="radio" class="minimal"
|
||||||
name="regular_class_3" @if($isInfo) disabled @endif
|
name="regular_class_3"
|
||||||
value="1" {{$regular_class_3? 'checked':''}}>
|
value="1" @if(isset($regular_class_3) && $regular_class_3 == 1) checked @endif>
|
||||||
<label class="form-check-label">{{ __("有効") }}</label>
|
<label class="form-check-label">{{ __("有効") }}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2 form-check">
|
<div class="col-2 form-check">
|
||||||
<input type="radio" class="minimal"
|
<input type="radio" class="minimal"
|
||||||
name="regular_class_3" @if($isInfo) disabled @endif
|
name="regular_class_3"
|
||||||
value="0" {{!$regular_class_3? 'checked':''}}>
|
value="0" @if(isset($regular_class_3) && $regular_class_3 === 0) checked @endif>
|
||||||
<label class="form-check-label">{{ __("無効") }}</label>
|
<label class="form-check-label">{{ __("無効") }}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.form group - 定期種別3 -->
|
|
||||||
|
|
||||||
<!-- 定期種別6 -->
|
<!-- 定期種別6 -->
|
||||||
<div class="form-group col-3">
|
<div class="form-group col-3">
|
||||||
@ -121,14 +136,14 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-2 offset-1 form-check">
|
<div class="col-2 offset-1 form-check">
|
||||||
<input type="radio" class="minimal"
|
<input type="radio" class="minimal"
|
||||||
name="regular_class_6" @if($isInfo) disabled @endif
|
name="regular_class_6"
|
||||||
value="1" {{$regular_class_6? 'checked':''}}>
|
value="1" @if(isset($regular_class_6) && $regular_class_6 == 1) checked @endif>
|
||||||
<label class="form-check-label">{{ __("有効") }}</label>
|
<label class="form-check-label">{{ __("有効") }}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2 form-check">
|
<div class="col-2 form-check">
|
||||||
<input type="radio" class="minimal"
|
<input type="radio" class="minimal"
|
||||||
name="regular_class_6" @if($isInfo) disabled @endif
|
name="regular_class_6"
|
||||||
value="0" {{!$regular_class_6? 'checked':''}}>
|
value="0" @if(isset($regular_class_6) && $regular_class_6 === 0) checked @endif>
|
||||||
<label class="form-check-label">{{ __("無効") }}</label>
|
<label class="form-check-label">{{ __("無効") }}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -142,19 +157,19 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-2 offset-1 form-check">
|
<div class="col-2 offset-1 form-check">
|
||||||
<input type="radio" class="minimal"
|
<input type="radio" class="minimal"
|
||||||
name="regular_class_12" @if($isInfo) disabled @endif
|
name="regular_class_12"
|
||||||
value="1" {{$regular_class_12? 'checked':''}}>
|
value="1" @if(isset($regular_class_12) && $regular_class_12 == 1) checked @endif>
|
||||||
<label class="form-check-label">{{ __("有効") }}</label>
|
<label class="form-check-label">{{ __("有効") }}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2 form-check">
|
<div class="col-2 form-check">
|
||||||
<input type="radio" class="minimal"
|
<input type="radio" class="minimal"
|
||||||
name="regular_class_12" @if($isInfo) disabled @endif
|
name="regular_class_12"
|
||||||
value="0" {{!$regular_class_12? 'checked':''}}>
|
value="0" @if(isset($regular_class_12) && $regular_class_12 === 0) checked @endif>
|
||||||
<label class="form-check-label">{{ __("無効") }}</label>
|
<label class="form-check-label">{{ __("無効") }}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.form group - 定期種別12 -->
|
|
||||||
|
|
||||||
<!-- 備考 -->
|
<!-- 備考 -->
|
||||||
<div class="form-group col-3">
|
<div class="form-group col-3">
|
||||||
@ -162,29 +177,36 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-9">
|
<div class="form-group col-9">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<textarea class="form-control form-control-lg" rows="5" placeholder="{{__('validation.attributes.memo')}}"
|
<textarea class="form-control form-control-lg"
|
||||||
name="memo" @if($isInfo) readonly @endif>{{$memo}}</textarea>
|
rows="5"
|
||||||
|
placeholder="{{ __('validation.attributes.memo') }}"
|
||||||
|
name="memo">{{ $memo }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.form group - 備考 -->
|
<!-- /.form group - 備考 -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if(!$isEdit)
|
{{-- ▼ 下部ボタン --}}
|
||||||
{{-- 新規登録画面の場合:「登録」ボタンを表示 --}}
|
<div class="form-group col-12 d-flex gap-2 mt-4">
|
||||||
<button type="submit" class="btn btn-lg btn-success register">
|
{{-- 登録ボタン --}}
|
||||||
|
<button type="submit"
|
||||||
|
class="btn btn-lg btn-success mr-2"
|
||||||
|
onclick="return confirm('登録してよろしいですか?')">
|
||||||
{{ __('登録') }}
|
{{ __('登録') }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@else
|
{{-- 削除ボタン(編集画面のみ表示) --}}
|
||||||
{{-- 編集画面の場合:「更新」「戻る」ボタンを表示 --}}
|
@if(!empty($regular_type->regular_type_id))
|
||||||
<button type="submit" class="btn btn-lg btn-success register">
|
</form>
|
||||||
{{ __('更新') }}
|
<form method="POST" action="{{ route('regular_types_delete') }}"
|
||||||
</button>
|
onsubmit="return confirm('本当に削除しますか?')" class="d-inline-block mr-2">
|
||||||
|
@csrf
|
||||||
<a href="{{ route('regular_types') }}" class="btn btn-lg btn-secondary">
|
<input type="hidden" name="pk" value="{{ $regular_type->regular_type_id }}">
|
||||||
{{ __('戻る') }}
|
<button type="submit" class="btn btn-lg btn-danger mr-2">{{ __('削除') }}</button>
|
||||||
</a>
|
</form>
|
||||||
@endif
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
<!-- TOKEN FORM -->
|
<!-- TOKEN FORM -->
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token() }}" >
|
<input type="hidden" name="_token" value="{{ csrf_token() }}" >
|
||||||
<!-- / .TOKEN FORM -->
|
<!-- / .TOKEN FORM -->
|
||||||
@include('admin.regular_types._form',['isEdit'=>1,'isInfo'=>0])
|
@include('admin.regular_types._form', ['isEdit' => true])
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -32,7 +32,11 @@
|
|||||||
|
|
||||||
<div class="container-fluid mb20">
|
<div class="container-fluid mb20">
|
||||||
<button type="button" class="btn btn-sm btn-default mr10" onclick="location.href='{{ route('regular_types_add') }}'">新規</button>
|
<button type="button" class="btn btn-sm btn-default mr10" onclick="location.href='{{ route('regular_types_add') }}'">新規</button>
|
||||||
<button type="button" class="btn btn-sm btn-default mr10" id="delete">削除</button>
|
<button type="button"
|
||||||
|
class="btn btn-sm btn-default mr10"
|
||||||
|
onclick="if(confirm('本当に削除しますか?')) { document.getElementById('form_delete').submit(); }">
|
||||||
|
削除
|
||||||
|
</button>
|
||||||
<!-- <button type="submit" class="btn btn-sm btn-default mr10" form="form_export">{{ __('CSV出力') }}</button> -->
|
<!-- <button type="submit" class="btn btn-sm btn-default mr10" form="form_export">{{ __('CSV出力') }}</button> -->
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{{ $list->appends(['sort' => $sort ?? '', 'sort_type' => $sort_type ?? ''])->links('pagination') }}
|
{{ $list->appends(['sort' => $sort ?? '', 'sort_type' => $sort_type ?? ''])->links('pagination') }}
|
||||||
@ -61,7 +65,7 @@
|
|||||||
<form action="{{ route('regular_types_delete') }}" method="POST" id="form_delete">
|
<form action="{{ route('regular_types_delete') }}" method="POST" id="form_delete">
|
||||||
@csrf
|
@csrf
|
||||||
<table class="table table-bordered dataTable text-nowrap">
|
<table class="table table-bordered dataTable text-nowrap">
|
||||||
<thead>
|
<thead class="thead-light">
|
||||||
<tr>
|
<tr>
|
||||||
{{-- チェック + 編集ボタン --}}
|
{{-- チェック + 編集ボタン --}}
|
||||||
<th style="width:140px;" class="text-left">
|
<th style="width:140px;" class="text-left">
|
||||||
|
|||||||
@ -450,7 +450,7 @@
|
|||||||
'stations',
|
'stations',
|
||||||
'terms',
|
'terms',
|
||||||
'contract_allowable_cities',
|
'contract_allowable_cities',
|
||||||
'pplace',
|
'pplaces',
|
||||||
];
|
];
|
||||||
$current = app('router')->currentRouteName();
|
$current = app('router')->currentRouteName();
|
||||||
@endphp
|
@endphp
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user