This commit is contained in:
parent
2662a5121d
commit
63cbd8a05d
@ -37,21 +37,23 @@ class PsectionController extends Controller
|
||||
'sort_type' => $sortType,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 新規追加
|
||||
public function add(Request $request)
|
||||
{
|
||||
if ($request->isMethod('post')) {
|
||||
$validated = $request->validate([
|
||||
'psection_id' => 'required|integer|unique:psection,psection_id',
|
||||
// 'psection_id' は自動採番なので不要
|
||||
'psection_subject' => 'required|string|max:255',
|
||||
]);
|
||||
|
||||
Psection::create($validated);
|
||||
return redirect()->route('psection')->with('success', '車種区分を追加しました');
|
||||
|
||||
return redirect()->route('psections')->with('success', '車室区分を追加しました');
|
||||
}
|
||||
return view('admin.psection.add');
|
||||
|
||||
// GET の場合は空のモデルを渡してフォームを表示
|
||||
return view('admin.psection.add', ['psection' => new Psection()]);
|
||||
}
|
||||
|
||||
// 編集
|
||||
@ -70,7 +72,7 @@ class PsectionController extends Controller
|
||||
$psection->update($validated);
|
||||
|
||||
// 成功メッセージ & リダイレクト
|
||||
return redirect()->route('psection')->with('success', '車種区分を更新しました');
|
||||
return redirect()->route('psections')->with('success', '車種区分を更新しました');
|
||||
}
|
||||
|
||||
// 編集画面を表示
|
||||
@ -88,11 +90,20 @@ class PsectionController extends Controller
|
||||
// 削除
|
||||
public function delete(Request $request)
|
||||
{
|
||||
$ids = $request->input('pk', []);
|
||||
if (!empty($ids)) {
|
||||
Psection::whereIn('psection_id', $ids)->delete();
|
||||
return redirect()->route('psection')->with('success', '削除しました');
|
||||
$arr_pk = $request->get('pk');
|
||||
|
||||
if (!is_array($arr_pk)) {
|
||||
$arr_pk = [$arr_pk];
|
||||
}
|
||||
return redirect()->route('psection')->with('error', '削除対象を選択してください');
|
||||
|
||||
if ($arr_pk && count($arr_pk) > 0) {
|
||||
if (Psection::whereIn('psection_id', $arr_pk)->delete()) {
|
||||
return redirect()->route('psections')->with('success', __("削除が完了しました。"));
|
||||
} else {
|
||||
return redirect()->route('psections')->with('error', __('削除に失敗しました。'));
|
||||
}
|
||||
}
|
||||
return redirect()->route('psections')->with('error', __('削除するデータを選択してください。'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -24,9 +24,11 @@ class PtypeController extends Controller
|
||||
];
|
||||
$inputs['isMethodPost'] = $request->isMethod('post');
|
||||
$inputs['list'] = Ptype::search($inputs);
|
||||
|
||||
if ($inputs['list']->total() > 0 && $inputs['page'] > $inputs['list']->lastPage()) {
|
||||
return redirect()->route('ptypes');
|
||||
}
|
||||
|
||||
return view('admin.ptypes.list', $inputs);
|
||||
}
|
||||
|
||||
@ -41,7 +43,7 @@ class PtypeController extends Controller
|
||||
if ($request->isMethod('POST')) {
|
||||
$rules = [
|
||||
'ptype_subject' => 'required|string|max:255',
|
||||
'ptype_sort' => 'nullable|integer',
|
||||
'floor_sort' => 'nullable|integer',
|
||||
'ptype_remarks' => 'nullable|string|max:255',
|
||||
];
|
||||
$messages = [
|
||||
@ -75,28 +77,30 @@ class PtypeController extends Controller
|
||||
{
|
||||
$ptype = Ptype::getByPk($pk);
|
||||
if (empty($pk) || empty($ptype)) {
|
||||
abort('404');
|
||||
abort(404);
|
||||
}
|
||||
$data = $ptype->getAttributes();
|
||||
|
||||
// 追加のドロップダウンなどがある場合
|
||||
$dataList = $this->getDataDropList();
|
||||
$data = array_merge($data, $dataList);
|
||||
|
||||
if ($request->isMethod('POST')) {
|
||||
$type = false;
|
||||
// ここを修正
|
||||
|
||||
// バリデーションルール
|
||||
$rules = [
|
||||
'ptype_subject' => 'required|string|max:255',
|
||||
'ptype_sort' => 'nullable|integer',
|
||||
'floor_sort' => 'nullable|integer',
|
||||
'ptype_remarks' => 'nullable|string|max:255',
|
||||
];
|
||||
$messages = [
|
||||
'ptype_subject.required' => '駐輪分類名は必須です。',
|
||||
];
|
||||
|
||||
$validator = Validator::make($request->all(), $rules, $messages);
|
||||
$requestAll = $request->all();
|
||||
$data = array_merge($data, $requestAll);
|
||||
|
||||
if (!$validator->fails()) {
|
||||
\DB::transaction(function () use ($data, &$type, $ptype) {
|
||||
$ptype->fill($data);
|
||||
\DB::transaction(function () use ($request, &$type, $ptype) {
|
||||
$ptype->fill($request->all());
|
||||
$ptype->save();
|
||||
$type = true;
|
||||
});
|
||||
@ -107,20 +111,33 @@ class PtypeController extends Controller
|
||||
$request->session()->flash('error', __('更新に失敗しました'));
|
||||
}
|
||||
} else {
|
||||
$data['errorMsg'] = $this->__buildErrorMessasges($validator);
|
||||
return redirect()->back()
|
||||
->withErrors($validator)
|
||||
->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
// Blade に渡すときはモデルそのものを渡す
|
||||
if ($view != '') {
|
||||
return view($view, $data);
|
||||
return view($view, array_merge($dataList, ['item' => $ptype]));
|
||||
}
|
||||
return view('admin.ptypes.edit', $data);
|
||||
return view('admin.ptypes.edit', array_merge($dataList, [
|
||||
'item' => $ptype,
|
||||
'ptype_id' => $ptype->ptype_id,
|
||||
]));
|
||||
}
|
||||
|
||||
public function delete(Request $request)
|
||||
{
|
||||
$arr_pk = $request->get('pk');
|
||||
if ($arr_pk) {
|
||||
if (Ptype::deleteByPk($arr_pk)) {
|
||||
|
||||
// 単体削除の場合 string が来るので配列に変換
|
||||
if (!is_array($arr_pk)) {
|
||||
$arr_pk = [$arr_pk];
|
||||
}
|
||||
|
||||
if ($arr_pk && count($arr_pk) > 0) {
|
||||
if (Ptype::whereIn('ptype_id', $arr_pk)->delete()) {
|
||||
return redirect()->route('ptypes')->with('success', __("削除が完了しました。"));
|
||||
} else {
|
||||
return redirect()->route('ptypes')->with('error', __('削除に失敗しました。'));
|
||||
|
||||
@ -33,6 +33,7 @@ class Ptype extends Model
|
||||
'ptype_subject',
|
||||
'ptype_remarks',
|
||||
'operator_id',
|
||||
'floor_sort',
|
||||
];
|
||||
|
||||
public static function search($inputs)
|
||||
@ -47,7 +48,7 @@ class Ptype extends Model
|
||||
if (!empty($inputs['isExport'])) {
|
||||
return $list->get();
|
||||
} else {
|
||||
return $list->paginate(\App\Models\Utils::item_per_page);
|
||||
return $list->paginate(20);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,172 +1,63 @@
|
||||
{{-- 駐輪場マスタ 共通フォーム --}}
|
||||
@if(Session::has('success'))
|
||||
<div class="alert alert-success alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
{{ Session::get('success') }}
|
||||
</div>
|
||||
@elseif(Session::has('error'))
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-ban"></i> {{__('誤差')}}:</h4>
|
||||
{!! Session::get('error') !!}
|
||||
</div>
|
||||
@elseif(isset($errorMsg))
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-ban"></i> {{__('誤差')}}:</h4>
|
||||
{!! $errorMsg !!}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="" enctype="multipart/form-data">
|
||||
@csrf
|
||||
|
||||
{{-- 駐輪場ID --}}
|
||||
<div class="card-body">
|
||||
{{-- 車室区分ID --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">駐輪場ID</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" name="park_id" value="{{ $park_id ?? '' }}" class="form-control" readonly>
|
||||
<label class="col-sm-2 col-form-label">車室区分ID</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="psection_id" class="form-control"
|
||||
value="{{ old('psection_id', $psection->psection_id ?? '') }}"
|
||||
@if(isset($psection)) readonly @endif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 市区 --}}
|
||||
{{-- 車室区分名 --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">市区 <span class="text-danger">*</span></label>
|
||||
<div class="col-md-4">
|
||||
<select class="form-control" name="city_id" @if($isInfo) disabled @endif>
|
||||
<option value="">市区を選択</option>
|
||||
@foreach($cities as $city)
|
||||
<option value="{{ $city->city_id }}" @if(old('city_id', $city_id ?? '') == $city->city_id) selected @endif>
|
||||
{{ $city->city_name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<label class="col-sm-2 col-form-label">車室区分名<span class="text-danger">*</span></label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="psection_subject" class="form-control"
|
||||
value="{{ old('psection_subject', $psection->psection_subject ?? '') }}" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 駐輪場名 --}}
|
||||
{{-- ▼ 下部ボタン --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">駐輪場名 <span class="text-danger">*</span></label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" name="park_name" value="{{ old('park_name', $park_name ?? '') }}" class="form-control" @if($isInfo) readonly @endif>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
|
||||
{{-- 駐輪場ふりがな --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">駐輪場ふりがな</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" name="park_ruby" value="{{ old('park_ruby', $park_ruby ?? '') }}" class="form-control" @if($isInfo) readonly @endif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 駐輪場五十音 --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">駐輪場五十音</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" name="park_syllabary" value="{{ old('park_syllabary', $park_syllabary ?? '') }}" class="form-control" @if($isInfo) readonly @endif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 住所 --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">住所</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="park_adrs" value="{{ old('park_adrs', $park_adrs ?? '') }}" class="form-control" @if($isInfo) readonly @endif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 閉設フラグ --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">閉設フラグ</label>
|
||||
<div class="col-md-6 d-flex align-items-center">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="park_close_flag" id="open" value="0" {{ (old('park_close_flag', $park_close_flag ?? 0) == 0) ? 'checked' : '' }} @if($isInfo) disabled @endif>
|
||||
<label class="form-check-label" for="open">開設</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="park_close_flag" id="close" value="1" {{ (old('park_close_flag', $park_close_flag ?? 0) == 1) ? 'checked' : '' }} @if($isInfo) disabled @endif>
|
||||
<label class="form-check-label" for="close">閉設</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="park_close_flag" id="prep" value="2" {{ (old('park_close_flag', $park_close_flag ?? 0) == 2) ? 'checked' : '' }} @if($isInfo) disabled @endif>
|
||||
<label class="form-check-label" for="prep">準備中</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 閉設日 --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">閉設日</label>
|
||||
<div class="col-md-4">
|
||||
<input type="date" name="park_day" value="{{ old('park_day', $park_day ?? '') }}" class="form-control" @if($isInfo) readonly @endif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 残警告チェックフラグ --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">残警告チェックフラグ</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" name="alert_flag" value="{{ old('alert_flag', $alert_flag ?? '') }}" class="form-control" @if($isInfo) readonly @endif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 印字数 --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">印字数</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" name="print_number" value="{{ old('print_number', $print_number ?? '') }}" class="form-control" @if($isInfo) readonly @endif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 最新キープアライブ --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">最新キープアライブ</label>
|
||||
<div class="col-md-4">
|
||||
<input type="datetime-local" name="keep_alive" value="{{ !empty($keep_alive) ? date('Y-m-d\TH:i', strtotime($keep_alive)) : '' }}" class="form-control" @if($isInfo) readonly @endif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- ---- 以下为未来扩展的字段,请用时补充数据库和控制器变量,并去掉注释 ---- --}}
|
||||
|
||||
{{--
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">料金メモ</label>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="price_memo" value="{{ old('price_memo', $price_memo ?? '') }}" class="form-control" @if($isInfo) readonly @endif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">更新期間開始日</label>
|
||||
<div class="col-md-4">
|
||||
<input type="date" name="update_start_date" value="{{ old('update_start_date', $update_start_date ?? '') }}" class="form-control" @if($isInfo) readonly @endif>
|
||||
</div>
|
||||
<label class="col-md-2 col-form-label">更新期間開始時</label>
|
||||
<div class="col-md-4">
|
||||
<input type="time" name="update_start_time" value="{{ old('update_start_time', $update_start_time ?? '') }}" class="form-control" @if($isInfo) readonly @endif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">契約後即利用許可</label>
|
||||
<div class="col-md-4">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="can_use_after_contract" value="1" @if(old('can_use_after_contract', $can_use_after_contract ?? '') == 1) checked @endif @if($isInfo) disabled @endif>
|
||||
<label class="form-check-label">許可する</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="can_use_after_contract" value="0" @if(old('can_use_after_contract', $can_use_after_contract ?? '') == 0) checked @endif @if($isInfo) disabled @endif>
|
||||
<label class="form-check-label">許可しない</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
--}}
|
||||
|
||||
{{-- 備考 --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">備考</label>
|
||||
<div class="col-md-8">
|
||||
<textarea name="note" class="form-control" rows="2" @if($isInfo) readonly @endif>{{ old('note', $note ?? '') }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- ここから他のフィールドも同様に追加 --}}
|
||||
{{-- ... --}}
|
||||
|
||||
{{-- 图片上传字段样例 --}}
|
||||
{{--
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-form-label">駐輪場画像1</label>
|
||||
<div class="col-md-4">
|
||||
<input type="file" name="parking_image1" class="form-control-file" @if($isInfo) disabled @endif>
|
||||
@if(!empty($parking_image1_url))
|
||||
<img src="{{ $parking_image1_url }}" alt="駐輪場画像1" class="img-thumbnail mt-2" style="max-width:200px;">
|
||||
{{-- 削除ボタン(編集画面のみ表示) --}}
|
||||
@if(!empty($psection->psection_id))
|
||||
</form>
|
||||
<form method="POST" action="{{ route('psections_delete') }}"
|
||||
onsubmit="return confirm('本当に削除しますか?')" class="d-inline-block mr-2">
|
||||
@csrf
|
||||
<input type="hidden" name="pk" value="{{ $psection->psection_id }}">
|
||||
<button type="submit" class="btn btn-lg btn-danger">{{ __('削除') }}</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
--}}
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@ -1,47 +1,46 @@
|
||||
|
||||
@extends('layouts.app')
|
||||
@section('title', '車種区分新規登録')
|
||||
@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="{{ url('/home') }}">ホーム</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('psection') }}">車種区分マスタ</a></li>
|
||||
<li class="breadcrumb-item active">新規登録</li>
|
||||
</ol>
|
||||
<!-- Content Header (Page header) -->
|
||||
<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><!-- /.col -->
|
||||
<div class="col-lg-6">
|
||||
<ol class="breadcrumb float-sm-right text-sm">
|
||||
<li class="breadcrumb-item"><a href="./index2.html">ホーム</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('psections') }}">車種区分マスタ</a></li>
|
||||
<li class="breadcrumb-item active">新規登録</li>
|
||||
</ol>
|
||||
</div><!-- /.col -->
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</div>
|
||||
<!-- /.content-header -->
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<!-- SELECT2 EXAMPLE -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<form method="post" action="{{ route('psections_add')}}" enctype="multipart/form-data">
|
||||
<!-- TOKEN FORM -->
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}" >
|
||||
<!-- / .TOKEN FORM -->
|
||||
@include('admin.psection._form',['isEdit'=>0,'isInfo'=>0])
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="alert alert-danger">
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ route('psection_add') }}">
|
||||
@csrf
|
||||
<div class="form-group">
|
||||
<label>車種区分ID <span class="text-danger">*</span></label>
|
||||
<input type="number" name="psection_id" class="form-control" value="{{ old('psection_id') }}" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>車種区分名 <span class="text-danger">*</span></label>
|
||||
<input type="text" name="psection_subject" class="form-control" value="{{ old('psection_subject') }}" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-lg btn-success"
|
||||
onclick="return confirm('保存してもよろしいですか?');">登録</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
|
||||
@ -7,12 +7,12 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-lg-6">
|
||||
<h1 class="m-0 text-dark">車種区分マスタ 編集</h1>
|
||||
<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('psection') }}">車種区分マスタ</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('psections') }}">車種区分マスタ</a></li>
|
||||
<li class="breadcrumb-item active">編集</li>
|
||||
</ol>
|
||||
</div>
|
||||
@ -23,44 +23,9 @@
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="card">
|
||||
<form method="POST" action="{{ route('psection_edit', ['id' => $psection->psection_id]) }}">
|
||||
<form method="POST" action="{{ route('psections_edit', ['id' => $psection->psection_id]) }}">
|
||||
@csrf
|
||||
<div class="card-body">
|
||||
{{-- 車種区分ID(読み取り専用) --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-3 col-form-label">車種区分ID</label>
|
||||
<div class="col-9">
|
||||
<input type="text" class="form-control" value="{{ $psection->psection_id }}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 車種区分名 --}}
|
||||
<div class="form-group row">
|
||||
<label class="col-3 col-form-label required">車種区分名</label>
|
||||
<div class="col-9">
|
||||
<input type="text" name="psection_subject"
|
||||
class="form-control @error('psection_subject') is-invalid @enderror"
|
||||
value="{{ old('psection_subject', $psection->psection_subject) }}">
|
||||
@error('psection_subject')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- ▼ 下部ボタン --}}
|
||||
<div class="text-left mb-3 ml-3">
|
||||
{{-- 登録ボタン --}}
|
||||
<button type="submit" class="btn btn-lg btn-success">登録</button>
|
||||
|
||||
{{-- 削除ボタン(同じ行に並べる) --}}
|
||||
<form method="POST" action="{{ route('psection_delete', ['id' => $psection->psection_id]) }}" class="d-inline">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-lg btn-danger"
|
||||
onclick="return confirm('この車種区分を削除しますか?');">削除</button>
|
||||
</form>
|
||||
</div>
|
||||
@include('admin.psection._form',['isEdit'=>1,'isInfo'=>0])
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -20,12 +20,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- ▼ メインコンテンツ --}}
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
|
||||
{{-- ▼ アクションボタン --}}
|
||||
<div class="mb-3">
|
||||
<a href="{{ route('psection_add') }}" class="btn btn-sm btn-default">新規</a>
|
||||
<a href="{{ route('psections_add') }}" class="btn btn-sm btn-default">新規</a>
|
||||
<button type="submit" form="deleteForm" class="btn btn-sm btn-default ml-2"
|
||||
onclick="return confirm('選択した区分を削除しますか?');">削除</button>
|
||||
</div>
|
||||
@ -38,8 +39,23 @@
|
||||
])->links('pagination') }}
|
||||
</div>
|
||||
|
||||
{{-- ▼ フラッシュメッセージ --}}
|
||||
@if(Session::has('success'))
|
||||
<div class="alert alert-success alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
{{ Session::get('success') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(Session::has('error'))
|
||||
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
{{ Session::get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($list->count() > 0)
|
||||
<form id="deleteForm" method="POST" action="{{ route('psection_delete') }}">
|
||||
<form id="deleteForm" method="POST" action="{{ route('psections_delete') }}">
|
||||
@csrf
|
||||
|
||||
<div class="table-responsive">
|
||||
@ -70,7 +86,7 @@
|
||||
{{-- ▼ 統合セル:チェック + 編集 --}}
|
||||
<td style="background: #faebd7;">
|
||||
<input type="checkbox" name="pk[]" value="{{ $item->psection_id }}">
|
||||
<a href="{{ route('psection_edit', ['id' => $item->psection_id]) }}"
|
||||
<a href="{{ route('psections_edit', ['id' => $item->psection_id]) }}"
|
||||
class="btn btn-sm btn-default ml10">編集</a>
|
||||
</td>
|
||||
|
||||
|
||||
@ -16,9 +16,6 @@
|
||||
{!! $errorMsg !!}
|
||||
</div>
|
||||
@endif
|
||||
<div class="card-header">
|
||||
<button type="submit" class="btn btn-lg btn-success register">{{__('登録')}}</button>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="form-group row">
|
||||
@ -36,7 +33,7 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">階数ソート順</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="ptype_sort" class="form-control" value="{{ old('ptype_sort', $item->ptype_sort ?? '') }}">
|
||||
<input type="text" name="floor_sort" class="form-control" value="{{ old('floor_sort', $item->floor_sort ?? '') }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
@ -47,6 +44,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-header">
|
||||
<button type="submit" class="btn btn-lg btn-success register">{{__('登録')}}</button>
|
||||
{{-- ▼ 下部ボタン --}}
|
||||
<div class="form-group col-12 d-flex gap-2 mt-4">
|
||||
{{-- 登録ボタン --}}
|
||||
<button type="submit" class="btn btn-lg btn-success mr-2">{{ __('登録') }}</button>
|
||||
|
||||
{{-- 削除ボタン(編集画面のみ表示) --}}
|
||||
@if(!empty($ptype_id))
|
||||
</form>
|
||||
<form method="POST" action="{{ route('ptypes_delete') }}"
|
||||
onsubmit="return confirm('本当に削除しますか?')" class="d-inline-block mr-2">
|
||||
@csrf
|
||||
<input type="hidden" name="pk" value="{{ $ptype_id }}">
|
||||
<button type="submit" class="btn btn-lg btn-danger mr-2">{{ __('削除') }}</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@ -8,14 +8,14 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-lg-6">
|
||||
<h1 class="m-0 text-dark">駐輪分類マスタ</h1>
|
||||
<h1 class="m-0 text-dark">新規登録</h1>
|
||||
</div><!-- /.col -->
|
||||
<div class="col-lg-6">
|
||||
<ol class="breadcrumb float-sm-right text-sm">
|
||||
<li class="breadcrumb-item"><a href="./index2.html">XX様info(ホーム)</a></li>
|
||||
<li class="breadcrumb-item"><a href="./index3.html">[東京都|〇〇駐輪場]</a></li>
|
||||
<li class="breadcrumb-item"><a href="./index2.html">ホーム</a></li>
|
||||
<!-- <li class="breadcrumb-item"><a href="./index3.html">[東京都|〇〇駐輪場]</a></li> -->
|
||||
<li class="breadcrumb-item"><a href="{{ route('ptypes') }}">駐輪分類マスタ</a></li>
|
||||
<li class="breadcrumb-item active">新規</li>
|
||||
<li class="breadcrumb-item active">新規登録</li>
|
||||
</ol>
|
||||
</div><!-- /.col -->
|
||||
</div><!-- /.row -->
|
||||
@ -31,7 +31,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<form method="post" action="{{ route('ptype_add')}}" enctype="multipart/form-data">
|
||||
<form method="post" action="{{ route('ptypes_add')}}" enctype="multipart/form-data">
|
||||
<!-- TOKEN FORM -->
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}" >
|
||||
<!-- / .TOKEN FORM -->
|
||||
|
||||
@ -7,12 +7,11 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-lg-6">
|
||||
<h1 class="m-0 text-dark">[東京都|〇〇駐輪場] 駐輪分類マスタ</h1>
|
||||
<h1 class="m-0 text-dark">編集</h1>
|
||||
</div><!-- /.col -->
|
||||
<div class="col-lg-6">
|
||||
<ol class="breadcrumb float-sm-right text-sm">
|
||||
<li class="breadcrumb-item"><a href="./index2.html">XX様info(ホーム)</a></li>
|
||||
<li class="breadcrumb-item"><a href="./index3.html">[東京都|〇〇駐輪場]</a></li>
|
||||
<li class="breadcrumb-item"><a href="./index2.html">ホーム</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('ptypes') }}">駐輪分類マスタ</a></li>
|
||||
<li class="breadcrumb-item active">編集</li>
|
||||
</ol>
|
||||
@ -30,7 +29,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<form method="post" action="{{ route('ptype_edit',['id'=>$ptype_id])}}" enctype="multipart/form-data">
|
||||
<form method="post" action="{{ route('ptypes_edit',['id'=>$ptype_id])}}" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@include('admin.ptypes._form',['isEdit'=>1,'isInfo'=>0])
|
||||
</form>
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<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="javascript: void(0);">[東京都|〇〇駐輪場]</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>
|
||||
</ol>
|
||||
</div>
|
||||
@ -22,11 +22,17 @@
|
||||
|
||||
{{-- ▼ メインコンテンツ --}}
|
||||
<section class="content">
|
||||
{{-- ▼ ソート用 hidden フォーム --}}
|
||||
<form id="list-form" method="POST" action="{{ route('ptypes') }}">
|
||||
@csrf
|
||||
<input type="hidden" name="sort" value="{{ $sort ?? '' }}">
|
||||
<input type="hidden" name="sort_type" value="{{ $sort_type ?? '' }}">
|
||||
</form>
|
||||
|
||||
{{-- ▼ アクションボタン(市区マスタ準拠) --}}
|
||||
<div class="mb-3">
|
||||
<a href="{{ route('ptype_add') }}" class="btn btn-sm btn-primary">新規</a>
|
||||
<button type="submit" form="deleteForm" class="btn btn-sm btn-danger ml-2"
|
||||
<a href="{{ route('ptypes_add') }}" class="btn btn-sm btn-default">新規</a>
|
||||
<button type="submit" form="deleteForm" class="btn btn-sm btn-default ml-2"
|
||||
onclick="return confirm('選択した分類を削除しますか?');">削除</button>
|
||||
</div>
|
||||
|
||||
@ -51,94 +57,80 @@
|
||||
@endif
|
||||
|
||||
{{-- ▼ 一覧(編集+チェックを統合列に変更:背景 #faebd7) --}}
|
||||
<form id="deleteForm" method="POST" action="{{ route('ptype_delete') }}">
|
||||
<form id="deleteForm" method="POST" action="{{ route('ptypes_delete') }}">
|
||||
@csrf
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover" style="min-width:700px;">
|
||||
{{-- ▼ ページネーション(表の上に表示) --}}
|
||||
<div class="d-flex justify-content-end mb-3">
|
||||
{{ $list->appends([
|
||||
'sort' => $sort ?? '',
|
||||
'sort_type' => $sort_type ?? ''
|
||||
])->links('pagination') }}
|
||||
</div>
|
||||
|
||||
<table class="table table-bordered dataTable text-nowrap">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
{{-- ▼ 統合列:全選択 + 編集(市区マスタ準拠) --}}
|
||||
<th style="width:140px;">
|
||||
{{-- ★ チェック + 編集 用の1列 --}}
|
||||
<th style="width:140px; border-left:1px solid #dcdcdc;" class="text-left">
|
||||
<input type="checkbox" onclick="$('input[name*=\'pk\']').prop('checked', this.checked);">
|
||||
<span class="text-muted" style="font-weight:normal;"></span>
|
||||
</th>
|
||||
{{-- ▼ ソート可能ヘッダー(ID / 名称 / 階数ソート順 / 備考) --}}
|
||||
<th style="width:140px;">
|
||||
<a href="{{ route('ptypes', ['sort' => 'ptype_id', 'sort_type' => ($sort == 'ptype_id' && $sort_type == 'asc') ? 'desc' : 'asc']) }}"
|
||||
style="color:inherit;text-decoration:none;">
|
||||
駐輪分類ID
|
||||
@if($sort == 'ptype_id')
|
||||
@if($sort_type == 'asc')
|
||||
<span style="font-size:1.0em;">▲</span>
|
||||
@else
|
||||
<span style="font-size:1.0em;">▼</span>
|
||||
@endif
|
||||
@endif
|
||||
</a>
|
||||
|
||||
</th>
|
||||
<th>
|
||||
<a href="{{ route('ptypes', ['sort' => 'ptype_subject', 'sort_type' => ($sort == 'ptype_subject' && $sort_type == 'asc') ? 'desc' : 'asc']) }}"
|
||||
style="color:inherit;text-decoration:none;">
|
||||
駐輪分類名
|
||||
@if($sort == 'ptype_subject')
|
||||
@if($sort_type == 'asc')
|
||||
<span style="font-size:1.0em;">▲</span>
|
||||
@else
|
||||
<span style="font-size:1.0em;">▼</span>
|
||||
@endif
|
||||
@endif
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a href="{{ route('ptypes', ['sort' => 'ptype_sort', 'sort_type' => ($sort == 'ptype_sort' && $sort_type == 'asc') ? 'desc' : 'asc']) }}"
|
||||
style="color:inherit;text-decoration:none;">
|
||||
階数ソート順
|
||||
@if($sort == 'ptype_sort')
|
||||
@if($sort_type == 'asc')
|
||||
<span style="font-size:1.0em;">▲</span>
|
||||
@else
|
||||
<span style="font-size:1.0em;">▼</span>
|
||||
@endif
|
||||
@endif
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a href="{{ route('ptypes', ['sort' => 'ptype_remarks', 'sort_type' => ($sort == 'ptype_remarks' && $sort_type == 'asc') ? 'desc' : 'asc']) }}"
|
||||
style="color:inherit;text-decoration:none;">
|
||||
備考
|
||||
@if($sort == 'ptype_remarks')
|
||||
@if($sort_type == 'asc')
|
||||
<span style="font-size:1.0em;">▲</span>
|
||||
@else
|
||||
<span style="font-size:1.0em;">▼</span>
|
||||
@endif
|
||||
@endif
|
||||
</a>
|
||||
{{-- ▼ ソート対象列 --}}
|
||||
<th class="sorting {{ ($sort=='ptype_id') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"
|
||||
sort="ptype_id">
|
||||
<span>駐輪分類ID</span>
|
||||
</th>
|
||||
{{-- ▼ ソート不可列 --}}
|
||||
<th><span>駐輪分類名</span></th>
|
||||
<th><span>階数ソート順</span></th>
|
||||
<th><span>備考</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody class="bg-white">
|
||||
@foreach($list as $item)
|
||||
<tr>
|
||||
{{-- ▼ 統合セル:チェック + 編集 --}}
|
||||
<td style="background:#faebd7;">
|
||||
<input type="checkbox" name="pk[]" value="{{ $item->ptype_id }}">
|
||||
<a href="{{ route('ptype_edit', ['id' => $item->ptype_id]) }}"
|
||||
class="btn btn-sm btn-default ml10">編集</a>
|
||||
<td class="align-middle" style="background-color:#faebd7; border-left:1px solid #dcdcdc;">
|
||||
<div class="d-flex align-items-center">
|
||||
<input type="checkbox" name="pk[]" value="{{ $item->ptype_id }}">
|
||||
<a href="{{ route('ptypes_edit', ['id' => $item->ptype_id]) }}"
|
||||
class="btn btn-sm btn-default ml10">編集</a>
|
||||
</div>
|
||||
</td>
|
||||
{{-- ▼ データ列 --}}
|
||||
<td>{{ $item->ptype_id }}</td>
|
||||
<td>{{ $item->ptype_subject }}</td>
|
||||
<td>{{ $item->ptype_sort }}</td>
|
||||
<td>{{ $item->floor_sort }}</td>
|
||||
<td>{{ $item->ptype_remarks }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
{{-- ▼ ページネーションをテーブルの外、左下に表示(Bootstrap4スタイル&パラメータ維持) --}}
|
||||
<div class="mt-3 text-left">
|
||||
{{ $list->appends(request()->except('page'))->links('pagination::bootstrap-4') }}
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
@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
|
||||
|
||||
|
||||
@ -457,7 +457,7 @@
|
||||
<i class="fa fa-circle-o nav-icon"></i>
|
||||
<p>{{ __("駐輪場所、料金マスタ") }}</p></a>
|
||||
</li>
|
||||
<li class="nav-item"><a href="{{ route('psection') }}" class="nav-link @if($current === 'psection') active @endif">
|
||||
<li class="nav-item"><a href="{{ route('psections') }}" class="nav-link @if($current === 'psections') active @endif">
|
||||
<i class="fa fa-circle-o nav-icon"></i>
|
||||
<p>{{ __("車種区分マスタ") }}</p></a>
|
||||
</li>
|
||||
|
||||
@ -187,19 +187,19 @@ Route::middleware('auth')->group(function () {
|
||||
Route::post('/admin/prices/export', [PriceController::class, 'export'])->name('prices_export');
|
||||
|
||||
//車種区分マスタ
|
||||
Route::match(['get', 'post'], '/admin/psection', [PsectionController::class, 'list'])->name('psection');
|
||||
Route::match(['get', 'post'], '/admin/psection/add', [PsectionController::class, 'add'])->name('psection_add');
|
||||
Route::match(['get', 'post'], '/admin/psection/edit/{id}', [PsectionController::class, 'edit'])->name('psection_edit')->where(['id' => '[0-9]+']);
|
||||
Route::post('/admin/psection/delete', [PsectionController::class, 'delete'])->name('psection_delete');
|
||||
Route::match(['get', 'post'], '/admin/psection', [PsectionController::class, 'list'])->name('psections');
|
||||
Route::match(['get', 'post'], '/admin/psection/add', [PsectionController::class, 'add'])->name('psections_add');
|
||||
Route::match(['get', 'post'], '/admin/psection/edit/{id}', [PsectionController::class, 'edit'])->name('psections_edit')->where(['id' => '[0-9]+']);
|
||||
Route::post('/admin/psection/delete', [PsectionController::class, 'delete'])->name('psections_delete');
|
||||
|
||||
//駐輪分類マスタ
|
||||
Route::match(['get', 'post'], '/admin/ptypes', [PtypeController::class, 'list'])->name(name: 'ptypes');
|
||||
Route::match(['get', 'post'], '/admin/ptypes/add', [PtypeController::class, 'add'])->name('ptype_add');
|
||||
Route::match(['get', 'post'], '/admin/ptypes/edit/{id}', [PtypeController::class, 'edit'])->name('ptype_edit')->where(['id' => '[0-9]+']);
|
||||
Route::match(['get', 'post'], '/admin/ptypes/info/{id}', [PtypeController::class, 'info'])->name('ptype_info')->where(['id' => '[0-9]+']);
|
||||
Route::match(['get', 'post'], '/admin/ptypes/delete', [PtypeController::class, 'delete'])->name('ptype_delete');
|
||||
Route::match(['get', 'post'], '/admin/ptypes/import', [PtypeController::class, 'import'])->name('ptype_import');
|
||||
Route::get('/admin/ptypes/export', [PtypeController::class, 'export'])->name('ptype_export');
|
||||
Route::match(['get', 'post'], '/admin/ptypes/add', [PtypeController::class, 'add'])->name('ptypes_add');
|
||||
Route::match(['get', 'post'], '/admin/ptypes/edit/{id}', [PtypeController::class, 'edit'])->name('ptypes_edit')->where(['id' => '[0-9]+']);
|
||||
Route::match(['get', 'post'], '/admin/ptypes/info/{id}', [PtypeController::class, 'info'])->name('ptypes_info')->where(['id' => '[0-9]+']);
|
||||
Route::match(['get', 'post'], '/admin/ptypes/delete', [PtypeController::class, 'delete'])->name('ptypes_delete');
|
||||
Route::match(['get', 'post'], '/admin/ptypes/import', [PtypeController::class, 'import'])->name('ptypes_import');
|
||||
Route::get('/admin/ptypes/export', [PtypeController::class, 'export'])->name('ptypes_export');
|
||||
|
||||
//定期利用・契約状況
|
||||
Route::match(['get', 'post'], '/periodical', [PeriodicalController::class, 'list'])->name('periodical');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user