This commit is contained in:
parent
9df0d9c2c5
commit
7fc3c33bed
@ -61,7 +61,7 @@ class RegularTypeController extends Controller
|
||||
$new->save();
|
||||
});
|
||||
|
||||
$request->session()->flash('success', __('新しい成功を創造する。'));
|
||||
$request->session()->flash('success', __('登録に成功しました。'));
|
||||
return redirect()->route('regular_types');
|
||||
}
|
||||
|
||||
@ -75,7 +75,15 @@ class RegularTypeController extends Controller
|
||||
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')) {
|
||||
|
||||
@ -129,18 +137,26 @@ class RegularTypeController extends Controller
|
||||
|
||||
public function delete(Request $request)
|
||||
{
|
||||
$arr_pk = $request->get('pk');
|
||||
$arr_pk = $request->get('pk'); // 配列で受け取る
|
||||
|
||||
if ($arr_pk) {
|
||||
if (RegularType::deleteByPk($arr_pk)) {
|
||||
return redirect()->route('regular_types')->with('success', __("削除が完了しました。"));
|
||||
$deleted = RegularType::destroy($arr_pk);
|
||||
|
||||
if ($deleted > 0) {
|
||||
return redirect()->route('regular_types')
|
||||
->with('success', __("削除が完了しました。"));
|
||||
} 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)
|
||||
{
|
||||
|
||||
|
||||
@ -38,8 +38,8 @@ class StationController extends Controller
|
||||
'station_route_name',
|
||||
'park_id',
|
||||
'operator_id',
|
||||
'station_latitude',
|
||||
'station_longitude',
|
||||
// 'station_latitude', 追加予定
|
||||
// 'station_longitude', 追加予定
|
||||
])
|
||||
->orderBy($sort, $sort_type)
|
||||
->paginate(20);
|
||||
|
||||
@ -14,14 +14,14 @@ class RegularTypeRequest extends FormRequest
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'city_id' => 'required|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'name.required' => '市区名は必須です。',
|
||||
'city_id.required' => '市区名は必須です。',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,172 +19,194 @@
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
@if($isEdit || $isInfo)
|
||||
<!-- 定期種別ID -->
|
||||
<div class="form-group col-3">
|
||||
<label>{{__('定期種別ID')}}</label>
|
||||
|
||||
{{-- バリデーションエラー表示 --}}
|
||||
@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>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="input-group">
|
||||
<input type="text" value="{{$regular_type_id}}"
|
||||
placeholder="{{__('validation.attributes.regular_type_id')}}"
|
||||
class="form-control form-control-lg" readonly/>
|
||||
<input type="text" name="regular_type_id"
|
||||
class="form-control text-right bg-light"
|
||||
value="{{ old('regular_type_id', $regular_type_id ?? '') }}"
|
||||
maxlength="10" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.form group - 定期種別ID -->
|
||||
@endIf
|
||||
|
||||
<!-- 市区名 -->
|
||||
<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 class="form-group col-9">
|
||||
<select class="form-control form-control-lg mb10" name="city_id" @if($isInfo) disabled @endif>
|
||||
<option value="">{{__('市区名')}}</option>
|
||||
<select class="form-control form-control-lg mb10"
|
||||
name="city_id"
|
||||
@if($isEdit) @else required @endif>
|
||||
<option value="">{{ __('市区名') }}</option>
|
||||
@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
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- 定期種別1 -->
|
||||
<div class="form-group col-3">
|
||||
<label>{{__('定期種別1')}}</label>
|
||||
<label>{{ __('定期種別1') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="row">
|
||||
<div class="col-2 offset-1 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_1" @if($isInfo) disabled @endif
|
||||
value="1" {{$regular_class_1? 'checked':''}}>
|
||||
<label class="form-check-label">{{__("有効")}}</label>
|
||||
name="regular_class_1"
|
||||
value="1" @if(isset($regular_class_1) && $regular_class_1 == 1) checked @endif>
|
||||
<label class="form-check-label">{{ __("有効") }}</label>
|
||||
</div>
|
||||
<div class="col-2 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_1" @if($isInfo) disabled @endif
|
||||
value="0" {{!$regular_class_1? 'checked':''}}>
|
||||
<label class="form-check-label">{{__("無効")}}</label>
|
||||
name="regular_class_1"
|
||||
value="0" @if(isset($regular_class_1) && $regular_class_1 === 0) checked @endif>
|
||||
<label class="form-check-label">{{ __("無効") }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.form group - 定期種別1 -->
|
||||
|
||||
|
||||
<!-- 定期種別2 -->
|
||||
<div class="form-group col-3">
|
||||
<label>{{__('定期種別2')}}</label>
|
||||
<label>{{ __('定期種別2') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="row">
|
||||
<div class="col-2 offset-1 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_2" @if($isInfo) disabled @endif
|
||||
value="1" {{$regular_class_2? 'checked':''}}>
|
||||
<label class="form-check-label">{{__("有効")}}</label>
|
||||
name="regular_class_2"
|
||||
value="1" @if(isset($regular_class_2) && $regular_class_2 == 1) checked @endif>
|
||||
<label class="form-check-label">{{ __("有効") }}</label>
|
||||
</div>
|
||||
<div class="col-2 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_2" @if($isInfo) disabled @endif
|
||||
value="0" {{!$regular_class_2? 'checked':''}}>
|
||||
<label class="form-check-label">{{__("無効")}}</label>
|
||||
name="regular_class_2"
|
||||
value="0" @if(isset($regular_class_2) && $regular_class_2 === 0) checked @endif>
|
||||
<label class="form-check-label">{{ __("無効") }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.form group - 定期種別2 -->
|
||||
|
||||
<!-- 定期種別3 -->
|
||||
<div class="form-group col-3">
|
||||
<label>{{__('定期種別3')}}</label>
|
||||
<label>{{ __('定期種別3') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="row">
|
||||
<div class="col-2 offset-1 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_3" @if($isInfo) disabled @endif
|
||||
value="1" {{$regular_class_3? 'checked':''}}>
|
||||
<label class="form-check-label">{{__("有効")}}</label>
|
||||
name="regular_class_3"
|
||||
value="1" @if(isset($regular_class_3) && $regular_class_3 == 1) checked @endif>
|
||||
<label class="form-check-label">{{ __("有効") }}</label>
|
||||
</div>
|
||||
<div class="col-2 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_3" @if($isInfo) disabled @endif
|
||||
value="0" {{!$regular_class_3? 'checked':''}}>
|
||||
<label class="form-check-label">{{__("無効")}}</label>
|
||||
name="regular_class_3"
|
||||
value="0" @if(isset($regular_class_3) && $regular_class_3 === 0) checked @endif>
|
||||
<label class="form-check-label">{{ __("無効") }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.form group - 定期種別3 -->
|
||||
|
||||
<!-- 定期種別6 -->
|
||||
<div class="form-group col-3">
|
||||
<label>{{__('定期種別6')}}</label>
|
||||
<label>{{ __('定期種別6') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="row">
|
||||
<div class="col-2 offset-1 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_6" @if($isInfo) disabled @endif
|
||||
value="1" {{$regular_class_6? 'checked':''}}>
|
||||
<label class="form-check-label">{{__("有効")}}</label>
|
||||
name="regular_class_6"
|
||||
value="1" @if(isset($regular_class_6) && $regular_class_6 == 1) checked @endif>
|
||||
<label class="form-check-label">{{ __("有効") }}</label>
|
||||
</div>
|
||||
<div class="col-2 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_6" @if($isInfo) disabled @endif
|
||||
value="0" {{!$regular_class_6? 'checked':''}}>
|
||||
<label class="form-check-label">{{__("無効")}}</label>
|
||||
name="regular_class_6"
|
||||
value="0" @if(isset($regular_class_6) && $regular_class_6 === 0) checked @endif>
|
||||
<label class="form-check-label">{{ __("無効") }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 定期種別12 -->
|
||||
<div class="form-group col-3">
|
||||
<label>{{__('定期種別12')}}</label>
|
||||
<label>{{ __('定期種別12') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="row">
|
||||
<div class="col-2 offset-1 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_12" @if($isInfo) disabled @endif
|
||||
value="1" {{$regular_class_12? 'checked':''}}>
|
||||
<label class="form-check-label">{{__("有効")}}</label>
|
||||
name="regular_class_12"
|
||||
value="1" @if(isset($regular_class_12) && $regular_class_12 == 1) checked @endif>
|
||||
<label class="form-check-label">{{ __("有効") }}</label>
|
||||
</div>
|
||||
<div class="col-2 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_12" @if($isInfo) disabled @endif
|
||||
value="0" {{!$regular_class_12? 'checked':''}}>
|
||||
<label class="form-check-label">{{__("無効")}}</label>
|
||||
name="regular_class_12"
|
||||
value="0" @if(isset($regular_class_12) && $regular_class_12 === 0) checked @endif>
|
||||
<label class="form-check-label">{{ __("無効") }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.form group - 定期種別12 -->
|
||||
|
||||
|
||||
<!-- 備考 -->
|
||||
<div class="form-group col-3">
|
||||
<label>{{__('備考')}}</label>
|
||||
<label>{{ __('備考') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="input-group">
|
||||
<textarea class="form-control form-control-lg" rows="5" placeholder="{{__('validation.attributes.memo')}}"
|
||||
name="memo" @if($isInfo) readonly @endif>{{$memo}}</textarea>
|
||||
<textarea class="form-control form-control-lg"
|
||||
rows="5"
|
||||
placeholder="{{ __('validation.attributes.memo') }}"
|
||||
name="memo">{{ $memo }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.form group - 備考 -->
|
||||
</div>
|
||||
|
||||
@if(!$isEdit)
|
||||
{{-- 新規登録画面の場合:「登録」ボタンを表示 --}}
|
||||
<button type="submit" class="btn btn-lg btn-success register">
|
||||
{{-- ▼ 下部ボタン --}}
|
||||
<div class="form-group col-12 d-flex gap-2 mt-4">
|
||||
{{-- 登録ボタン --}}
|
||||
<button type="submit"
|
||||
class="btn btn-lg btn-success mr-2"
|
||||
onclick="return confirm('登録してよろしいですか?')">
|
||||
{{ __('登録') }}
|
||||
</button>
|
||||
|
||||
@else
|
||||
{{-- 編集画面の場合:「更新」「戻る」ボタンを表示 --}}
|
||||
<button type="submit" class="btn btn-lg btn-success register">
|
||||
{{ __('更新') }}
|
||||
</button>
|
||||
|
||||
<a href="{{ route('regular_types') }}" class="btn btn-lg btn-secondary">
|
||||
{{ __('戻る') }}
|
||||
</a>
|
||||
{{-- 削除ボタン(編集画面のみ表示) --}}
|
||||
@if(!empty($regular_type->regular_type_id))
|
||||
</form>
|
||||
<form method="POST" action="{{ route('regular_types_delete') }}"
|
||||
onsubmit="return confirm('本当に削除しますか?')" class="d-inline-block mr-2">
|
||||
@csrf
|
||||
<input type="hidden" name="pk" value="{{ $regular_type->regular_type_id }}">
|
||||
<button type="submit" class="btn btn-lg btn-danger mr-2">{{ __('削除') }}</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
<!-- TOKEN FORM -->
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}" >
|
||||
<!-- / .TOKEN FORM -->
|
||||
@include('admin.regular_types._form',['isEdit'=>1,'isInfo'=>0])
|
||||
@include('admin.regular_types._form', ['isEdit' => true])
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -32,7 +32,11 @@
|
||||
|
||||
<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" 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> -->
|
||||
<div class="d-flex justify-content-end">
|
||||
{{ $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">
|
||||
@csrf
|
||||
<table class="table table-bordered dataTable text-nowrap">
|
||||
<thead>
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
{{-- チェック + 編集ボタン --}}
|
||||
<th style="width:140px;" class="text-left">
|
||||
|
||||
@ -450,7 +450,7 @@
|
||||
'stations',
|
||||
'terms',
|
||||
'contract_allowable_cities',
|
||||
'pplace',
|
||||
'pplaces',
|
||||
];
|
||||
$current = app('router')->currentRouteName();
|
||||
@endphp
|
||||
|
||||
Loading…
Reference in New Issue
Block a user