This commit is contained in:
parent
4df74f116c
commit
9a0f8a8846
@ -122,18 +122,15 @@ class PplaceController extends Controller
|
||||
|
||||
public function export()
|
||||
{
|
||||
$headers = [
|
||||
"Content-type" => "text/csv;charset=UTF-8",
|
||||
"Content-Disposition" => "attachment; filename=Pplace.csv",
|
||||
];
|
||||
$filename = '駐輪車室マスタ' . now()->format('YmdHis') . '.csv';
|
||||
|
||||
$data = Pplace::all();
|
||||
$columns = ['ID', '番号', '備考', 'オペレータID'];
|
||||
|
||||
$filename = "Pplace.csv";
|
||||
$file = fopen($filename, 'w+');
|
||||
fwrite($file, "\xEF\xBB\xBF"); // BOM追加(UTF-8)
|
||||
|
||||
$columns = ['駐輪車室ID', '番号', '備考', 'オペレータID'];
|
||||
fputcsv($file, $columns);
|
||||
|
||||
$data = Pplace::all();
|
||||
foreach ($data as $item) {
|
||||
fputcsv($file, [
|
||||
$item->pplace_id,
|
||||
@ -144,9 +141,16 @@ class PplaceController extends Controller
|
||||
}
|
||||
|
||||
fclose($file);
|
||||
return Response::download($filename, $filename, $headers);
|
||||
|
||||
$headers = [
|
||||
"Content-Type" => "text/csv; charset=UTF-8",
|
||||
"Content-Disposition" => "attachment; filename={$filename}",
|
||||
];
|
||||
|
||||
return response()->download($filename, $filename, $headers)->deleteFileAfterSend(true);
|
||||
}
|
||||
|
||||
|
||||
public function import(Request $request)
|
||||
{
|
||||
$file = $request->file('file');
|
||||
|
||||
@ -14,7 +14,6 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
// use Response;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class PriceController extends Controller
|
||||
@ -137,62 +136,51 @@ class PriceController extends Controller
|
||||
return self::whereIn('price_parkplaceid', $ids)->delete();
|
||||
}
|
||||
|
||||
public function exportGet(Request $request)
|
||||
public function export()
|
||||
{
|
||||
$headers = [
|
||||
"Content-Type" => "text/csv; charset=UTF-8",
|
||||
"Content-Disposition" => "attachment; filename=駐輪場所、料金マスタ.csv",
|
||||
];
|
||||
$filename = '駐輪場所、料金マスタ' . now()->format('YmdHis') . '.csv';
|
||||
|
||||
$query = Price::query();
|
||||
$file = fopen($filename, 'w+');
|
||||
fwrite($file, "\xEF\xBB\xBF"); // BOM追加(UTF-8)
|
||||
|
||||
// 🔹 パラメータ取得(GETでもOK)
|
||||
if ($request->filled('park_id')) {
|
||||
$query->where('park_id', $request->input('park_id'));
|
||||
}
|
||||
|
||||
if ($request->filled('sort')) {
|
||||
$query->orderBy($request->input('sort'), $request->input('sort_type', 'asc'));
|
||||
}
|
||||
|
||||
$dataExport = $query->get();
|
||||
|
||||
// 🔹 CSV列定義
|
||||
$columns = [
|
||||
'駐車場所ID', '商品名', '期間', '駐輪場ID', '駐輪場名',
|
||||
'車種区分ID', '車種区分', '駐輪分類ID', '駐輪分類',
|
||||
'利用者分類ID', '利用者分類', '駐車車室ID', '駐輪料金(税込)',
|
||||
'駐輪場所ID',
|
||||
'駐輪場ID',
|
||||
'商品名',
|
||||
'期間',
|
||||
'利用者分類ID',
|
||||
'駐輪料金(税込)',
|
||||
'車種区分ID',
|
||||
'駐輪分類ID',
|
||||
'駐車車室ID',
|
||||
];
|
||||
|
||||
// 🔹 CSV生成
|
||||
$filename = '駐輪場所、料金マスタ.csv';
|
||||
$path = storage_path('app/' . $filename);
|
||||
$file = fopen($path, 'w+');
|
||||
fwrite($file, "\xEF\xBB\xBF"); // Excel対応のBOM
|
||||
fputcsv($file, $columns);
|
||||
|
||||
foreach ($dataExport as $item) {
|
||||
$data = Price::all();
|
||||
foreach ($data as $item) {
|
||||
fputcsv($file, [
|
||||
$item->price_parkplaceid,
|
||||
$item->prine_name,
|
||||
$item->price_month,
|
||||
$item->park_id,
|
||||
optional($item->getPark())->park_name,
|
||||
$item->psection_id,
|
||||
optional($item->getPSection())->psection_subject,
|
||||
$item->price_ptypeid,
|
||||
optional($item->getPType())->ptype_subject,
|
||||
$item->user_categoryid,
|
||||
optional($item->getUserType())->print_name,
|
||||
$item->pplace_id,
|
||||
$item->price,
|
||||
$item->price_parkplaceid, // 駐輪場所ID
|
||||
$item->park_id, // 駐輪場ID
|
||||
optional($item->getUserType())->print_name, // 利用者分類名
|
||||
$item->price_month, // 期間
|
||||
optional($item->getUserType())->print_name, // 利用者分類ID
|
||||
$item->price, // 駐輪料金(税込)
|
||||
optional($item->getPSection())->psection_subject, // 車種区分名
|
||||
optional($item->getPType())->ptype_subject, // 駐輪分類名
|
||||
$item->pplace_id, // 駐車車室ID
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
fclose($file);
|
||||
|
||||
// 🔹 ダウンロードレスポンス
|
||||
return response()->download($path, $filename, $headers)->deleteFileAfterSend(true);
|
||||
$headers = [
|
||||
"Content-Type" => "text/csv; charset=UTF-8",
|
||||
"Content-Disposition" => "attachment; filename={$filename}",
|
||||
];
|
||||
|
||||
return response()->download($filename, $filename, $headers)->deleteFileAfterSend(true);
|
||||
}
|
||||
|
||||
public function import(Request $request)
|
||||
|
||||
@ -25,7 +25,7 @@ class PrintAreaController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
// 新規登録
|
||||
// 新規
|
||||
public function add(Request $request)
|
||||
{
|
||||
if ($request->isMethod('post')) {
|
||||
@ -72,35 +72,67 @@ class PrintAreaController extends Controller
|
||||
return view('admin.print_areas.info', compact('record'));
|
||||
}
|
||||
|
||||
public function delete(Request $request)
|
||||
/**
|
||||
* 印刷範囲マスタ削除処理
|
||||
*/
|
||||
public function delete(Request $request, $id = null)
|
||||
{
|
||||
// バリデーション:'pk'は必須、配列の場合は各要素が整数
|
||||
// 一覧画面(checkboxで複数削除)
|
||||
$ids = $request->input('pk');
|
||||
|
||||
// 編集画面(単体削除)
|
||||
if ($id) {
|
||||
$ids = [$id];
|
||||
}
|
||||
|
||||
// 削除対象が空
|
||||
if (empty($ids)) {
|
||||
return redirect()
|
||||
->route('print_areas')
|
||||
->with('error', '削除対象が選択されていません。');
|
||||
}
|
||||
|
||||
// バリデーション:配列 or 単一でも整数確認
|
||||
$request->validate([
|
||||
'pk' => 'required',
|
||||
'pk' => 'nullable',
|
||||
'pk.*' => 'integer',
|
||||
]);
|
||||
|
||||
// pkを配列化(単一でも配列でも対応)
|
||||
$ids = (array)$request->input('pk');
|
||||
try {
|
||||
// 削除処理
|
||||
$deleted = PrintArea::destroy($ids);
|
||||
|
||||
// 削除処理
|
||||
$deleted = PrintArea::destroy($ids);
|
||||
if ($deleted > 0) {
|
||||
return redirect()
|
||||
->route('print_areas')
|
||||
->with('success', '削除しました。');
|
||||
} else {
|
||||
return redirect()
|
||||
->route('print_areas')
|
||||
->with('error', '削除に失敗しました。');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
\Log::error('印刷範囲削除エラー: ' . $e->getMessage());
|
||||
|
||||
// 削除結果によってメッセージを分岐
|
||||
if ($deleted > 0) {
|
||||
return redirect()->route('print_areas')->with('success', '削除しました。');
|
||||
} else {
|
||||
return redirect()->route('print_areas')->with('error', '削除に失敗しました。');
|
||||
return redirect()
|
||||
->route('print_areas')
|
||||
->with('error', '削除中にエラーが発生しました。');
|
||||
}
|
||||
}
|
||||
|
||||
// CSVエクスポート
|
||||
public function export(Request $request)
|
||||
{
|
||||
$filename = 'print_areas_' . now()->format('Ymd_His') . '.csv';
|
||||
// ファイル名を日本語付きで指定(Excelで問題なく開けるようにUTF-8にBOMも付加)
|
||||
$filename = 'シール印刷範囲マスタ' . now()->format('YmdHis') . '.csv';
|
||||
|
||||
$data = PrintArea::with('park')->get();
|
||||
|
||||
// UTF-8 BOM (Excel用)
|
||||
$bom = "\xEF\xBB\xBF";
|
||||
|
||||
// CSVヘッダー
|
||||
$csv = implode(",", ['印刷範囲ID', '印刷範囲名', '駐輪場ID', '駐輪場名']) . "\n";
|
||||
|
||||
foreach ($data as $item) {
|
||||
$csv .= implode(",", [
|
||||
$item->print_area_id,
|
||||
@ -110,11 +142,13 @@ class PrintAreaController extends Controller
|
||||
]) . "\n";
|
||||
}
|
||||
|
||||
return response($csv)
|
||||
->header('Content-Type', 'text/csv')
|
||||
->header('Content-Disposition', "attachment; filename=$filename");
|
||||
return response($bom . $csv)
|
||||
->header('Content-Type', 'text/csv; charset=UTF-8')
|
||||
// filename* にすれば日本語名も安全に動作
|
||||
->header('Content-Disposition', "attachment; filename*=UTF-8''" . rawurlencode($filename));
|
||||
}
|
||||
|
||||
|
||||
// CSVインポート(仮)
|
||||
public function import(Request $request)
|
||||
{
|
||||
|
||||
@ -33,17 +33,21 @@ class RegularTypeController extends Controller
|
||||
];
|
||||
$viewData = array_merge($inputs, $dataList);
|
||||
|
||||
$record = new RegularType();
|
||||
|
||||
if ($request->isMethod('POST')) {
|
||||
$validation = new RegularTypeRequest();
|
||||
$rules = $validation->rules();
|
||||
$validator = Validator::make($request->all(), $rules, $validation->messages());
|
||||
|
||||
if ($validator->fails()) {
|
||||
$viewData['errorMsg'] = $this->buildErrorMessages($validator);
|
||||
return view('admin.regular_types.add', array_merge($viewData, $request->all()));
|
||||
return redirect()
|
||||
->back()
|
||||
->withErrors($validator)
|
||||
->withInput();
|
||||
}
|
||||
|
||||
// 仅允许写入的字段(白名单)
|
||||
// バリデーション成功
|
||||
$payload = array_intersect_key($request->all(), array_flip([
|
||||
'city_id',
|
||||
'regular_class_1',
|
||||
@ -61,41 +65,47 @@ class RegularTypeController extends Controller
|
||||
$new->save();
|
||||
});
|
||||
|
||||
$request->session()->flash('success', __('登録に成功しました。'));
|
||||
$request->session()->flash('success', __('登録しました。'));
|
||||
return redirect()->route('regular_types');
|
||||
}
|
||||
|
||||
return view('admin.regular_types.add', $viewData);
|
||||
return view('admin.regular_types.add', array_merge($viewData, [
|
||||
'record' => $record,
|
||||
]));
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id, $view = '')
|
||||
{
|
||||
$regular_type = RegularType::getById($id);
|
||||
if (empty($id) || empty($regular_type)) {
|
||||
// --- データ取得 ---
|
||||
$record = RegularType::getById($id);
|
||||
if (empty($id) || empty($record)) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
// --- 初期表示用データ ---
|
||||
$data = array_merge(
|
||||
$regular_type->getAttributes(),
|
||||
$record->getAttributes(),
|
||||
$this->getDataDropList(),
|
||||
[
|
||||
'regular_type' => $regular_type,
|
||||
'record' => $record,
|
||||
'isEdit' => true,
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
// --- 更新処理 ---
|
||||
if ($request->isMethod('POST')) {
|
||||
|
||||
$validation = new RegularTypeRequest();
|
||||
$rules = $validation->rules();
|
||||
$validator = Validator::make($request->all(), $rules, $validation->messages());
|
||||
|
||||
// city_name → city_id の補正
|
||||
$requestAll = $request->all();
|
||||
if (isset($requestAll['city_name']) && !isset($requestAll['city_id'])) {
|
||||
$requestAll['city_id'] = $requestAll['city_name'];
|
||||
}
|
||||
|
||||
// 書き込み対象のカラムのみ許可
|
||||
$payload = array_intersect_key($requestAll, array_flip([
|
||||
'city_id',
|
||||
'regular_class_1',
|
||||
@ -106,23 +116,26 @@ class RegularTypeController extends Controller
|
||||
'memo',
|
||||
]));
|
||||
|
||||
// バリデーションエラー
|
||||
if ($validator->fails()) {
|
||||
$data['errorMsg'] = $this->buildErrorMessages($validator);
|
||||
|
||||
$data = array_merge($data, $payload);
|
||||
|
||||
if ($view !== '') return view($view, $data);
|
||||
return view('admin.regular_types.edit', $data);
|
||||
}
|
||||
|
||||
DB::transaction(function () use (&$regular_type, $payload) {
|
||||
$regular_type->fill($payload);
|
||||
$regular_type->save();
|
||||
// 更新
|
||||
DB::transaction(function () use (&$record, $payload) {
|
||||
$record->fill($payload);
|
||||
$record->save();
|
||||
});
|
||||
|
||||
$request->session()->flash('success', __('更新に成功しました'));
|
||||
return redirect()->route('regular_types');
|
||||
}
|
||||
|
||||
// --- 画面表示 ---
|
||||
if ($view !== '') {
|
||||
return view($view, $data);
|
||||
}
|
||||
@ -135,24 +148,29 @@ class RegularTypeController extends Controller
|
||||
return implode("\n", $validator->errors()->all());
|
||||
}
|
||||
|
||||
public function delete(Request $request)
|
||||
public function delete(Request $request, $id = null)
|
||||
{
|
||||
$arr_pk = $request->get('pk'); // 配列で受け取る
|
||||
// 一覧画面(checkbox で複数削除)
|
||||
$ids = $request->input('pk');
|
||||
|
||||
if ($arr_pk) {
|
||||
$deleted = RegularType::destroy($arr_pk);
|
||||
|
||||
if ($deleted > 0) {
|
||||
return redirect()->route('regular_types')
|
||||
->with('success', __("削除が完了しました。"));
|
||||
} else {
|
||||
return redirect()->route('regular_types')
|
||||
->with('error', __('削除に失敗しました。'));
|
||||
}
|
||||
// 編集画面(単体削除)
|
||||
if ($id) {
|
||||
$ids = [$id];
|
||||
}
|
||||
|
||||
return redirect()->route('regular_types')
|
||||
->with('error', __('削除するデータを選択してください。'));
|
||||
// 削除対象が空の場合
|
||||
if (empty($ids)) {
|
||||
return redirect()
|
||||
->route('regular_types')
|
||||
->with('error', '削除対象が選択されていません。');
|
||||
}
|
||||
|
||||
// 削除処理
|
||||
RegularType::destroy($ids);
|
||||
|
||||
return redirect()
|
||||
->route('regular_types')
|
||||
->with('success', '削除しました。');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -41,16 +41,12 @@
|
||||
{{-- 削除 --}}
|
||||
<button type="button" class="btn btn-sm btn-default mr10" id="delete">{{ __('削除') }}</button>
|
||||
|
||||
|
||||
<form id="form_export_csv" method="POST" action="{{ route('prices_export') }}" style="display:inline;">
|
||||
@csrf
|
||||
<input type="hidden" name="park_id" value="{{ $park_id ?? '' }}">
|
||||
<input type="hidden" name="sort" value="{{ $sort ?? '' }}">
|
||||
<input type="hidden" name="sort_type" value="{{ $sort_type ?? '' }}">
|
||||
<button type="button" id="export_csv" class="btn btn-sm btn-default mr10">
|
||||
CSV出力
|
||||
</button>
|
||||
</form>
|
||||
<button type="button"
|
||||
id="export_csv"
|
||||
class="btn btn-sm btn-default mr10"
|
||||
action="{{ route('prices_export') }}">
|
||||
{{ __('CSV出力') }}
|
||||
</button>
|
||||
|
||||
{{-- エクスポート(条件選択モーダル) --}}
|
||||
<button type="button" class="btn btn-sm btn-default mr10" data-toggle="modal" data-target="#exportModal">
|
||||
|
||||
@ -1,35 +1,25 @@
|
||||
{{-- アラート --}}
|
||||
@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>
|
||||
<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($errors->any())
|
||||
<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>
|
||||
<ul>
|
||||
@foreach($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
{{-- バリデーションエラー表示 --}}
|
||||
@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="row mb-3">
|
||||
@if($isEdit)
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
@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-sm-6">
|
||||
<h1 class="m-0 text-dark">新規登録</h1>
|
||||
<h1 class="m-0 text-dark">新規</h1>
|
||||
</div>
|
||||
<div class="col-sm-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('print_areas') }}">シール印刷範囲マスタ</a></li>
|
||||
<li class="breadcrumb-item active">新規登録</li>
|
||||
<li class="breadcrumb-item active">新規</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -35,20 +35,37 @@
|
||||
<div class="container-fluid mb20">
|
||||
<button type="button" class="btn btn-sm btn-default mr10" onclick="location.href='{{ route('print_areas_add') }}'">新規</button>
|
||||
<button type="button" class="btn btn-sm btn-default mr10" id="delete">削除</button>
|
||||
<button type="submit" class="btn btn-sm btn-default mr10" form="form_export">CSV出力</button>
|
||||
<button type="button" class="btn btn-sm btn-default mr10" onclick="location.href='{{ route('print_areas_import') }}'">インポート</button>
|
||||
<!-- <button type="submit" class="btn btn-sm btn-default mr10" form="form_export">CSV出力</button> -->
|
||||
<button type="button"
|
||||
id="export_csv"
|
||||
class="btn btn-sm btn-default mr10"
|
||||
action="{{ route('print_areas_export') }}">
|
||||
{{ __('CSV出力') }}
|
||||
</button>
|
||||
<div class="d-flex justify-content-end">
|
||||
{{ $list->appends(['sort' => $sort ?? '', 'sort_type' => $sort_type ?? ''])->links('pagination') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- メッセージ表示 -->
|
||||
<div class="col-lg-12">
|
||||
@if(session('success'))
|
||||
<div class="alert alert-success alert-dismissible">{{ session('success') }}</div>
|
||||
@elseif(session('error'))
|
||||
<div class="alert alert-danger alert-dismissible">{{ session('error') }}</div>
|
||||
|
||||
{{-- ▼ フラッシュメッセージ --}}
|
||||
<div class="form col-lg-12">
|
||||
@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
|
||||
</div>
|
||||
|
||||
@ -66,7 +83,7 @@
|
||||
</th>
|
||||
<th class="sorting {{ ($sort=='print_area_id') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="print_area_id"><span>印刷範囲ID</span></th>
|
||||
<th class="sorting {{ ($sort=='print_area_name') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}" sort="print_area_name"><span>印刷範囲名</span></th>
|
||||
<th><span>駐輪場名</span></th>
|
||||
<th><span>駐輪場ID</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class=bg-white>
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
<input type="hidden" name="sort_type" value="{{ $sort_type ?? '' }}">
|
||||
</form>
|
||||
|
||||
{{-- ▼ アクションボタン(市区マスタ準拠) --}}
|
||||
{{-- ▼ アクションボタン --}}
|
||||
<div class="mb-3">
|
||||
<a href="{{ route('ptypes_add') }}" class="btn btn-sm btn-default">新規</a>
|
||||
<button type="button" class="btn btn-sm btn-default mr10" id="delete">削除</button>
|
||||
|
||||
@ -1,70 +1,61 @@
|
||||
{{-- アラート --}}
|
||||
@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'))
|
||||
@endif
|
||||
|
||||
@if($errors->any())
|
||||
<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 !!}
|
||||
<h4><i class="icon fa fa-ban"></i> {{ __('入力内容に不備があります:') }}</h4>
|
||||
<ul>
|
||||
@foreach($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
|
||||
{{-- バリデーションエラー表示 --}}
|
||||
@if ($errors->any())
|
||||
<div class="alert alert-danger">
|
||||
<ul class="mb-0">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
{{-- ▼ 定期種別ID(自動採番:編集時のみ表示) --}}
|
||||
@if($isEdit)
|
||||
<div class="col-3">
|
||||
<label>{{ __('定期種別ID') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="input-group">
|
||||
<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>
|
||||
@endif
|
||||
|
||||
<!-- 定期種別ID(自動採番) -->
|
||||
<div class="col-3">
|
||||
<label>{{ __('定期種別ID') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="input-group">
|
||||
<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>
|
||||
|
||||
<!-- 市区名 -->
|
||||
{{-- ▼ 市区名 --}}
|
||||
<div class="form-group col-3">
|
||||
<label class="form-label">
|
||||
{{ __('市区名') }}
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<label class="form-label required">{{ __('市区名') }}</label>
|
||||
</div>
|
||||
<div class="form-group col-9">
|
||||
<div class="col-9">
|
||||
<select class="form-control form-control-lg mb10"
|
||||
name="city_id"
|
||||
@if($isEdit) @else required @endif>
|
||||
{{ !$isEdit ? 'required' : '' }}>
|
||||
<option value="">{{ __('市区名') }}</option>
|
||||
@foreach($cities as $key => $val)
|
||||
<option value="{{ $key }}" @if($city_id == $key) selected @endif>
|
||||
<option value="{{ $key }}" {{ (old('city_id', $record->city_id ?? '') == $key) ? 'selected' : '' }}>
|
||||
{{ $val }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 定期種別1 -->
|
||||
|
||||
<div class="form-group col-3">
|
||||
<label>{{ __('定期種別1') }}</label>
|
||||
</div>
|
||||
@ -73,19 +64,21 @@
|
||||
<div class="col-2 offset-1 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_1"
|
||||
value="1" @if(isset($regular_class_1) && $regular_class_1 == 1) checked @endif>
|
||||
value="1"
|
||||
{{-- 新規時デフォルト有効 --}}
|
||||
@if((!$isEdit && !isset($regular_class_1)) || (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"
|
||||
value="0" @if(isset($regular_class_1) && $regular_class_1 === 0) checked @endif>
|
||||
value="0"
|
||||
@if(isset($regular_class_1) && $regular_class_1 === 0) checked @endif>
|
||||
<label class="form-check-label">{{ __("無効") }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 定期種別2 -->
|
||||
<div class="form-group col-3">
|
||||
<label>{{ __('定期種別2') }}</label>
|
||||
@ -95,7 +88,8 @@
|
||||
<div class="col-2 offset-1 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_2"
|
||||
value="1" @if(isset($regular_class_2) && $regular_class_2 == 1) checked @endif>
|
||||
value="1"
|
||||
@if((!$isEdit && !isset($regular_class_2)) || (isset($regular_class_2) && $regular_class_2 == 1)) checked @endif>
|
||||
<label class="form-check-label">{{ __("有効") }}</label>
|
||||
</div>
|
||||
<div class="col-2 form-check">
|
||||
@ -116,7 +110,7 @@
|
||||
<div class="col-2 offset-1 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_3"
|
||||
value="1" @if(isset($regular_class_3) && $regular_class_3 == 1) checked @endif>
|
||||
value="1" @if((!$isEdit && !isset($regular_class_3)) || (isset($regular_class_3) && $regular_class_3 == 1)) checked @endif>
|
||||
<label class="form-check-label">{{ __("有効") }}</label>
|
||||
</div>
|
||||
<div class="col-2 form-check">
|
||||
@ -137,7 +131,8 @@
|
||||
<div class="col-2 offset-1 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_6"
|
||||
value="1" @if(isset($regular_class_6) && $regular_class_6 == 1) checked @endif>
|
||||
value="1"
|
||||
@if((!$isEdit && !isset($regular_class_6)) || (isset($regular_class_6) && $regular_class_6 == 1)) checked @endif>
|
||||
<label class="form-check-label">{{ __("有効") }}</label>
|
||||
</div>
|
||||
<div class="col-2 form-check">
|
||||
@ -158,7 +153,8 @@
|
||||
<div class="col-2 offset-1 form-check">
|
||||
<input type="radio" class="minimal"
|
||||
name="regular_class_12"
|
||||
value="1" @if(isset($regular_class_12) && $regular_class_12 == 1) checked @endif>
|
||||
value="1"
|
||||
@if((!$isEdit && !isset($regular_class_12)) || (isset($regular_class_12) && $regular_class_12 == 1)) checked @endif>
|
||||
<label class="form-check-label">{{ __("有効") }}</label>
|
||||
</div>
|
||||
<div class="col-2 form-check">
|
||||
@ -187,24 +183,28 @@
|
||||
</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="row mt-4">
|
||||
<div class="form-group col-md-10 d-flex align-items-center gap-2 justify-content-start">
|
||||
|
||||
{{-- 削除ボタン(編集画面のみ表示) --}}
|
||||
@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
|
||||
{{-- 登録ボタン --}}
|
||||
@if($isEdit)
|
||||
<button type="button" id="register_edit" class="btn btn-lg btn-success mr-2">
|
||||
{{ __('登録') }}
|
||||
</button>
|
||||
@else
|
||||
<button type="button" id="register" class="btn btn-lg btn-success mr-2 register">
|
||||
{{ __('登録') }}
|
||||
</button>
|
||||
@endif
|
||||
|
||||
{{-- 削除ボタン(編集時のみ表示) --}}
|
||||
@if($isEdit)
|
||||
<button type="button" id="delete_edit" class="btn btn-lg btn-danger">
|
||||
{{ __('削除') }}
|
||||
</button>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
|
||||
@extends('layouts.app')
|
||||
@section('title', '[東京都|〇〇駐輪場] 定期種別マスタ')
|
||||
@section('title', '新規')
|
||||
|
||||
@section('content')
|
||||
<!-- Content Header (Page header) -->
|
||||
@ -8,13 +8,13 @@
|
||||
<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="{{ route('home') }}">ホーム</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('regular_types') }}">定期種別マスタ</a></li>
|
||||
<li class="breadcrumb-item">新規登録</li>
|
||||
<li class="breadcrumb-item">新規</li>
|
||||
</ol>
|
||||
</div><!-- /.col -->
|
||||
</div><!-- /.row -->
|
||||
@ -30,11 +30,9 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<form method="post" action="{{ route('regular_types_add')}}" enctype="multipart/form-data">
|
||||
<!-- TOKEN FORM -->
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}" >
|
||||
<!-- / .TOKEN FORM -->
|
||||
@include('admin.regular_types._form',['isEdit'=>0,'isInfo'=>0])
|
||||
<form id="form_add" action="{{ route('regular_types_add') }}" method="POST">
|
||||
@csrf
|
||||
@include('admin.regular_types._form', ['isEdit' => false, 'record' => $record])
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
|
||||
@extends('layouts.app')
|
||||
@section('title', '[東京都|〇〇駐輪場] 定期種別マスタ')
|
||||
@section('title', '編集')
|
||||
|
||||
@section('content')
|
||||
<!-- Content Header (Page header) -->
|
||||
@ -30,11 +30,20 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<form method="post" action="{{ route('regular_types_edit',['id'=>$regular_type_id])}}" enctype="multipart/form-data">
|
||||
<!-- TOKEN FORM -->
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}" >
|
||||
<!-- / .TOKEN FORM -->
|
||||
@include('admin.regular_types._form', ['isEdit' => true])
|
||||
<form id="form_edit"
|
||||
action="{{ route('regular_types_edit', ['id' => $record->regular_type_id]) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
@include('admin.regular_types._form', ['isEdit' => true])
|
||||
</form>
|
||||
|
||||
{{-- Delete Form --}}
|
||||
<form id="form_delete"
|
||||
action="{{ route('regular_types_delete') }}"
|
||||
method="POST"
|
||||
style="display:none;">
|
||||
@csrf
|
||||
<input type="hidden" name="pk" value="{{ $record->regular_type_id }}">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
|
||||
@extends('layouts.app')
|
||||
@section('title', '[東京都|〇〇駐輪場] 定期種別マスタ')
|
||||
|
||||
@section('content')
|
||||
<!-- 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">XX様info(ホーム)</a></li>
|
||||
<li class="breadcrumb-item"><a href="./index3.html">[東京都|〇〇駐輪場]</a></li>
|
||||
<li class="breadcrumb-item">定期種別マスタ</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('regular_types_info',['id'=>$regular_type_id])}}" enctype="multipart/form-data">
|
||||
<!-- TOKEN FORM -->
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}" >
|
||||
<!-- / .TOKEN FORM -->
|
||||
@include('admin.regular_types._form',['isEdit'=>0,'isInfo'=>1])
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid mb20">
|
||||
<button type="submit" class="btn btn-sm btn-default mr10">{{__('削除')}}</button>
|
||||
<button type="submit" class="btn btn-sm btn-default mr10">{{__('インポート')}}</button>
|
||||
<button type="submit" class="btn btn-sm btn-default mr10">{{__('CSV出力')}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
|
||||
@endsection
|
||||
@ -1,5 +1,5 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', '[東京都|〇〇駐輪場] 定期種別マスタ')
|
||||
@section('title', '定期種別マスタ')
|
||||
|
||||
@section('content')
|
||||
<!-- Content Header -->
|
||||
@ -32,11 +32,7 @@
|
||||
|
||||
<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="if(confirm('本当に削除しますか?')) { document.getElementById('form_delete').submit(); }">
|
||||
削除
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-default mr10" id="delete">削除</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') }}
|
||||
@ -45,6 +41,7 @@
|
||||
|
||||
<!-- メッセージ表示 -->
|
||||
<div class="col-lg-12">
|
||||
{{-- ▼ フラッシュメッセージ --}}
|
||||
@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>
|
||||
@ -53,12 +50,16 @@
|
||||
@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>
|
||||
<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
|
||||
</div>
|
||||
|
||||
<!-- ▼ 単一テーブル構成 -->
|
||||
<div class="col-lg-12 mb20">
|
||||
<div class="table-responsive">
|
||||
|
||||
@ -184,11 +184,7 @@ Route::middleware('auth')->group(function () {
|
||||
Route::match(['get', 'post'], '/admin/prices/info/{id}', [PriceController::class, 'info'])->name('price_info')->where(['id' => '[0-9]+']);
|
||||
Route::match(['get', 'post'], '/admin/prices/delete', [PriceController::class, 'delete'])->name('prices_delete');
|
||||
Route::match(['get', 'post'], '/admin/prices/import', [PriceController::class, 'import'])->name('prices_import');
|
||||
|
||||
// kin 修正
|
||||
// CSV出力(GET対応版)
|
||||
Route::get('/admin/prices/export', [PriceController::class, 'exportGet'])
|
||||
->name('prices_export');
|
||||
Route::get('/admin/prices/export', [PriceController::class, 'export'])->name('prices_export');
|
||||
|
||||
|
||||
//車種区分マスタ
|
||||
|
||||
Loading…
Reference in New Issue
Block a user