車種区分マスタ画面修正
This commit is contained in:
parent
464755b870
commit
2df716e781
@ -32,6 +32,8 @@ class PriceController extends Controller
|
|||||||
if ($inputs['list']->total() > 0 && $inputs['page'] > $inputs['list']->lastPage()) {
|
if ($inputs['list']->total() > 0 && $inputs['page'] > $inputs['list']->lastPage()) {
|
||||||
return redirect()->route('prices');
|
return redirect()->route('prices');
|
||||||
}
|
}
|
||||||
|
$dataList = $this->getDataDropList();
|
||||||
|
$inputs = array_merge($inputs, $dataList);
|
||||||
|
|
||||||
return view('admin.prices.list', $inputs);
|
return view('admin.prices.list', $inputs);
|
||||||
}
|
}
|
||||||
@ -39,204 +41,278 @@ class PriceController extends Controller
|
|||||||
|
|
||||||
public function add(Request $request)
|
public function add(Request $request)
|
||||||
{
|
{
|
||||||
$inputs = [
|
// POST の場合のみバリデーション + 保存
|
||||||
'price_parkplaceid' => $request->input('price_parkplaceid'), // 駐車場所ID
|
|
||||||
'park_id' => $request->input('park_id'), // 駐輪場ID
|
|
||||||
'prine_name' => $request->input('prine_name'), // 商品名
|
|
||||||
'price_month' => $request->input('price_month',''), // 期間
|
|
||||||
'user_categoryid' => $request->input('user_categoryid'), // 利用者分類ID
|
|
||||||
'price' => $request->input('price'), // 駐輪料金(税込)
|
|
||||||
'psection_id' => $request->input('psection_id'), // 車種区分ID
|
|
||||||
'price_ptypeid' => $request->input('price_ptypeid'), // 駐輪分類ID
|
|
||||||
'pplace_id' => $request->input('pplace_id'), // 駐車車室ID
|
|
||||||
];
|
|
||||||
|
|
||||||
$dataList = $this->getDataDropList();
|
|
||||||
$inputs = array_merge($inputs, $dataList);
|
|
||||||
if ($request->isMethod('POST')) {
|
if ($request->isMethod('POST')) {
|
||||||
|
|
||||||
|
// ★ 1. 全角数字を半角に変換(例:123 → 123)
|
||||||
|
$request->merge([
|
||||||
|
'pplace_id' => mb_convert_kana($request->input('pplace_id'), 'n'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// バリデーション
|
||||||
|
$validated = $request->validate([
|
||||||
|
'price_parkplaceid' => 'required|integer', // 駐車場所ID
|
||||||
|
'park_id' => 'required|integer', // 駐輪場ID
|
||||||
|
'prine_name' => 'required|string|max:255', // 商品名
|
||||||
|
'price_month' => 'nullable|integer', // 期間(月)
|
||||||
|
'user_categoryid' => 'required|integer', // 利用者分類ID
|
||||||
|
'price' => 'required|numeric|min:0', // 駐輪料金(税込)
|
||||||
|
'psection_id' => 'required|integer', // 車種区分ID
|
||||||
|
'price_ptypeid' => 'required|integer', // 駐輪分類ID
|
||||||
|
'pplace_id' => 'required|integer', // 駐車車室ID
|
||||||
|
], [
|
||||||
|
'pplace_id.integer' => '駐車車室ID は整数で入力してください。',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// DB 登録
|
||||||
$type = false;
|
$type = false;
|
||||||
\DB::transaction(function () use ($inputs, &$type) {
|
\DB::transaction(function () use ($validated, &$type) {
|
||||||
$new = new Price();
|
$new = new Price();
|
||||||
$new->fill($inputs);
|
$new->fill($validated);
|
||||||
if( $new->save()){
|
if ($new->save()) {
|
||||||
$type = true;
|
$type = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 結果
|
||||||
if ($type) {
|
if ($type) {
|
||||||
$request->session()->flash('success', __('新しい成功を創造する。'));
|
return redirect()->route('prices')
|
||||||
return redirect()->route('prices');
|
->with('success', __('新しい成功を創造する。'));
|
||||||
} else {
|
} else {
|
||||||
$request->session()->flash('error', __('新しい作成に失敗しました'));
|
return redirect()->route('prices')
|
||||||
|
->with('error', __('新しい作成に失敗しました。'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('admin.prices.add', $inputs);
|
// GET の場合 → 画面表示
|
||||||
|
$dataList = $this->getDataDropList();
|
||||||
|
return view('admin.prices.add', $dataList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit(Request $request, $pk ,$view=''){
|
|
||||||
|
public function edit(Request $request, $pk ,$view='')
|
||||||
|
{
|
||||||
$price = Price::getByPk($pk);
|
$price = Price::getByPk($pk);
|
||||||
if (empty($pk) || empty($price)) {
|
if (empty($pk) || empty($price)) {
|
||||||
abort('404');
|
abort(404);
|
||||||
}
|
}
|
||||||
$data = $price->getAttributes();
|
$data = $price->getAttributes();
|
||||||
$dataList = $this->getDataDropList();
|
$dataList = $this->getDataDropList();
|
||||||
$data = array_merge($data, $dataList);
|
$data = array_merge($data, $dataList);
|
||||||
|
|
||||||
if ($request->isMethod('POST')) {
|
if ($request->isMethod('POST')) {
|
||||||
$type = false;
|
$type = false;
|
||||||
$requestAll = [
|
$requestAll = [
|
||||||
'price_parkplaceid' => $request->input('price_parkplaceid'),
|
'price_parkplaceid' => $request->input('price_parkplaceid'),
|
||||||
'park_id' => $request->input('park_id'),
|
'park_id' => $request->input('park_id'),
|
||||||
'prine_name' => $request->input('prine_name'),
|
'prine_name' => $request->input('prine_name'),
|
||||||
'price_month' => $request->input('price_month',''),
|
'price_month' => $request->input('price_month',''),
|
||||||
'user_categoryid' => $request->input('user_categoryid'),
|
'user_categoryid' => $request->input('user_categoryid'),
|
||||||
'price' => $request->input('price'),
|
'price' => $request->input('price'),
|
||||||
'psection_id' => $request->input('psection_id'),
|
'psection_id' => $request->input('psection_id'),
|
||||||
'price_ptypeid' => $request->input('price_ptypeid'),
|
'price_ptypeid' => $request->input('price_ptypeid'),
|
||||||
'pplace_id' => $request->input('pplace_id'),
|
'pplace_id' => $request->input('pplace_id'),
|
||||||
];
|
];
|
||||||
$data = array_merge($data, $requestAll);
|
$data = array_merge($data, $requestAll);
|
||||||
\DB::transaction(function () use ($data, &$type,$price) {
|
|
||||||
|
\DB::transaction(function () use ($data, &$type, $price) {
|
||||||
$price->fill($data);
|
$price->fill($data);
|
||||||
$price->save();
|
$price->save();
|
||||||
$type = true;
|
$type = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($type) {
|
if ($type) {
|
||||||
$request->session()->flash('success', __('更新に成功しました'));
|
return redirect()->route('prices')->with('success', __('更新に成功しました。'));
|
||||||
return redirect()->route('prices');
|
|
||||||
} else {
|
} else {
|
||||||
$request->session()->flash('error', __('更新に失敗しました'));
|
return redirect()->route('prices')->with('error', __('更新に失敗しました。'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($view != '') {
|
if ($view != '') {
|
||||||
return view($view, $data);
|
return view($view, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('admin.prices.edit', $data);
|
return view('admin.prices.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 (Price::deleteByPk($arr_pk)) {
|
$ids = is_array($arr_pk) ? $arr_pk : [$arr_pk];
|
||||||
return redirect()->route('prices')->with('success', __("削除成功。"));
|
|
||||||
|
if (Price::deleteByPk($ids)) {
|
||||||
|
return redirect()->route('prices')->with('success', __("削除成功しました。"));
|
||||||
} else {
|
} else {
|
||||||
return redirect()->route('prices')->with('error', __('削除に失敗しました。'));
|
return redirect()->route('prices')->with('error', __('削除に失敗しました。'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('prices')->with('error', __('削除するユーザーを選択してください。'));
|
return redirect()->route('prices')->with('error', __('削除するユーザーを選択してください。'));
|
||||||
}
|
}
|
||||||
|
public static function deleteByPk($ids)
|
||||||
|
{
|
||||||
|
if (!is_array($ids)) {
|
||||||
|
$ids = [$ids];
|
||||||
|
}
|
||||||
|
return self::whereIn('price_parkplaceid', $ids)->delete();
|
||||||
|
}
|
||||||
|
|
||||||
public function export(Request $request)
|
public function export(Request $request)
|
||||||
{
|
{
|
||||||
|
$headers = [
|
||||||
$headers = array(
|
|
||||||
"Content-type" => "text/csv;charset=UTF-8",
|
"Content-type" => "text/csv;charset=UTF-8",
|
||||||
'Content-Encoding: UTF-8',
|
'Content-Encoding: UTF-8',
|
||||||
"Content-Disposition" => "attachment; filename=file.csv",
|
"Content-Disposition" => "attachment; filename=file.csv",
|
||||||
"Pragma" => "no-cache",
|
"Pragma" => "no-cache",
|
||||||
"Cache-Control" => "must-revalidate, post-check=0, pre-check=0",
|
"Cache-Control" => "must-revalidate, post-check=0, pre-check=0",
|
||||||
"Expires" => "0"
|
"Expires" => "0"
|
||||||
);
|
|
||||||
$inputs = [
|
|
||||||
'isMethodPost' => 0,
|
|
||||||
'isExport' => 1,
|
|
||||||
'sort' => $request->input('sort', ''),
|
|
||||||
'sort_type' => $request->input('sort_type', ''),
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$dataExport = Price::search($inputs);
|
$query = Price::query();
|
||||||
$columns = array(
|
|
||||||
__('駐車場所ID'),// 0
|
// 🚩 条件付きエクスポート(park_id)
|
||||||
__('商品名'),// 1
|
if ($request->filled('park_id')) {
|
||||||
__('期間'),// 2
|
$query->where('park_id', $request->input('park_id'));
|
||||||
__('駐輪場ID'),// 3
|
}
|
||||||
__('駐輪場名'),// 3
|
|
||||||
__('車種区分ID'),// 5
|
// ソート
|
||||||
__('車種区分'),// 6
|
if ($request->filled('sort')) {
|
||||||
__('駐輪分類ID'),// 7
|
$query->orderBy($request->input('sort'), $request->input('sort_type', 'asc'));
|
||||||
__('駐輪分類'),// 8
|
}
|
||||||
__('利用者分類ID'),// 9
|
|
||||||
__('利用者分類'),// 10
|
$dataExport = $query->get();
|
||||||
__('駐車車室ID'),//11
|
|
||||||
__('駐輪料金(税込)'),// 12
|
$columns = [
|
||||||
);
|
__('駐車場所ID'),
|
||||||
$filename = "駐輪場所、料金マスタ.csv";
|
__('商品名'),
|
||||||
|
__('期間'),
|
||||||
|
__('駐輪場ID'),
|
||||||
|
__('駐輪場名'),
|
||||||
|
__('車種区分ID'),
|
||||||
|
__('車種区分'),
|
||||||
|
__('駐輪分類ID'),
|
||||||
|
__('駐輪分類'),
|
||||||
|
__('利用者分類ID'),
|
||||||
|
__('利用者分類'),
|
||||||
|
__('駐車車室ID'),
|
||||||
|
__('駐輪料金(税込)'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$filename = "駐輪場所、料金マスタ.csv";
|
||||||
$file = fopen($filename, 'w+');
|
$file = fopen($filename, 'w+');
|
||||||
fputcsv($file, $columns);
|
fputcsv($file, $columns);
|
||||||
|
|
||||||
foreach ($dataExport as $items) {
|
foreach ($dataExport as $items) {
|
||||||
fputcsv($file, array(
|
fputcsv($file, [
|
||||||
$items->price_parkplaceid,// 0
|
$items->price_parkplaceid,
|
||||||
$items->prine_name, // 1
|
$items->prine_name,
|
||||||
$items->price_month, // 2
|
$items->price_month,
|
||||||
$items->park_id, // 3
|
$items->park_id,
|
||||||
!empty($items->getPark())? $items->getPark()->park_name:'' ,// 4
|
optional($items->getPark())->park_name,
|
||||||
$items->psection_id, // 5
|
$items->psection_id,
|
||||||
!empty($items->getPSection())? $items->getPSection()->psection_subject:'',// 6
|
optional($items->getPSection())->psection_subject,
|
||||||
$items->price_ptypeid, // 7
|
$items->price_ptypeid,
|
||||||
!empty($items->getPType())? $items->getPType()->ptype_subject:'' ,// 8
|
optional($items->getPType())->ptype_subject,
|
||||||
$items->user_categoryid, //9
|
$items->user_categoryid,
|
||||||
!empty($items->getUserType())? $items->getUserType()->print_name:'' ,//10
|
optional($items->getUserType())->print_name,
|
||||||
$items->pplace_id,// 11
|
$items->pplace_id,
|
||||||
$items->price, // 12
|
$items->price,
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
fclose($file);
|
fclose($file);
|
||||||
|
|
||||||
return Response::download($filename, $filename, $headers);
|
return Response::download($filename, $filename, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function import(Request $request)
|
public function import(Request $request)
|
||||||
{
|
{
|
||||||
$file = $request->file('file');
|
$file = $request->file('file');
|
||||||
if(!empty($file)){
|
if (empty($file)) {
|
||||||
$data = Utils::csvToArray($file);
|
return redirect()->route('prices')->with('error', __('CSVファイルを選択してください。'));
|
||||||
$type = 1;
|
}
|
||||||
$msg = '';
|
|
||||||
$record = 0;
|
$data = Utils::csvToArray($file);
|
||||||
DB::beginTransaction();
|
$type = true;
|
||||||
try {
|
$msg = '';
|
||||||
Price::query()->delete();
|
$record = 0;
|
||||||
$col = 13;
|
|
||||||
foreach ($data as $key => $items) {
|
DB::beginTransaction();
|
||||||
$record = $key + 2;
|
try {
|
||||||
if (count($items) == $col) {
|
// 先清空数据(全置換仕様なら残す)
|
||||||
$row = new Price();
|
Price::query()->delete();
|
||||||
$row->price_parkplaceid = $items[0];
|
|
||||||
$row->prine_name = $items[1];
|
$col = 13; // CSV 項目数
|
||||||
$row->price_month = $items[2];
|
foreach ($data as $key => $items) {
|
||||||
$row->park_id = $items[3];
|
$record = $key + 2; // エラー行番号(ヘッダ行を考慮)
|
||||||
$row->psection_id = $items[5];
|
|
||||||
$row->price_ptypeid = $items[7];
|
// 項目数チェック
|
||||||
$row->user_categoryid = $items[9];
|
if (count($items) != $col) {
|
||||||
$row->pplace_id = $items[11];
|
$type = false;
|
||||||
$row->price = $items[12];
|
$msg = "行:{$record} 列数が一致しません。";
|
||||||
if (!$row->save()) {
|
break;
|
||||||
$type = 0;
|
}
|
||||||
$msg = '行:record型が一致しません。';
|
|
||||||
break;
|
// 必須チェック
|
||||||
}
|
if (empty($items[0])) { $type = false; $msg = "行:{$record} 駐車場所IDが未設定です。"; break; }
|
||||||
} else {
|
if (empty($items[1])) { $type = false; $msg = "行:{$record} 商品名が未設定です。"; break; }
|
||||||
$type = 0;
|
if (empty($items[2])) { $type = false; $msg = "行:{$record} 期間が未設定です。"; break; }
|
||||||
$msg = '行:record列数が一致しません。';
|
if (empty($items[3])) { $type = false; $msg = "行:{$record} 駐輪場IDが未設定です。"; break; }
|
||||||
break;
|
if (empty($items[5])) { $type = false; $msg = "行:{$record} 車種区分IDが未設定です。"; break; }
|
||||||
}
|
if (empty($items[7])) { $type = false; $msg = "行:{$record} 駐輪分類IDが未設定です。"; break; }
|
||||||
|
if (empty($items[9])) { $type = false; $msg = "行:{$record} 利用者分類IDが未設定です。"; break; }
|
||||||
|
if (empty($items[11])) { $type = false; $msg = "行:{$record} 駐車車室IDが未設定です。"; break; }
|
||||||
|
if (empty($items[12])) { $type = false; $msg = "行:{$record} 駐輪料金が未設定です。"; break; }
|
||||||
|
|
||||||
|
// マスタ存在チェック
|
||||||
|
if (!Park::where('park_id', $items[3])->exists()) {
|
||||||
|
$type = false; $msg = "行:{$record} 駐輪場IDが存在しません。"; break;
|
||||||
|
}
|
||||||
|
if (!Psection::where('psection_id', $items[5])->exists()) {
|
||||||
|
$type = false; $msg = "行:{$record} 車種区分IDが存在しません。"; break;
|
||||||
|
}
|
||||||
|
if (!Ptype::where('ptype_id', $items[7])->exists()) {
|
||||||
|
$type = false; $msg = "行:{$record} 駐輪分類IDが存在しません。"; break;
|
||||||
|
}
|
||||||
|
if (!Usertype::where('user_categoryid', $items[9])->exists()) {
|
||||||
|
$type = false; $msg = "行:{$record} 利用者分類IDが存在しません。"; break;
|
||||||
|
}
|
||||||
|
// TODO: 駐車車室ID チェック(pplace_id)
|
||||||
|
|
||||||
|
// 保存
|
||||||
|
$row = new Price();
|
||||||
|
$row->price_parkplaceid = $items[0];
|
||||||
|
$row->prine_name = $items[1];
|
||||||
|
$row->price_month = $items[2];
|
||||||
|
$row->park_id = $items[3];
|
||||||
|
$row->psection_id = $items[5];
|
||||||
|
$row->price_ptypeid = $items[7];
|
||||||
|
$row->user_categoryid = $items[9];
|
||||||
|
$row->pplace_id = $items[11];
|
||||||
|
$row->price = $items[12];
|
||||||
|
|
||||||
|
if (!$row->save()) {
|
||||||
|
$type = false; $msg = "行:{$record} データ保存に失敗しました。"; break;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
|
||||||
$msg = '行:record型が一致しません。';
|
|
||||||
$type = 0;
|
|
||||||
}
|
|
||||||
if ($type) {
|
|
||||||
DB::commit();
|
|
||||||
return redirect()->route('prices')->with('success', __('輸入成功'));
|
|
||||||
} else {
|
|
||||||
DB::rollBack();
|
|
||||||
return redirect()->route('prices')->with('error', __($msg, ['record' => $record]));
|
|
||||||
}
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$type = false;
|
||||||
|
$msg = "行:{$record} 予期せぬエラー: ".$e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type) {
|
||||||
|
DB::commit();
|
||||||
|
return redirect()->route('prices')->with('success', __('インポートが正常に完了しました。'));
|
||||||
} else {
|
} else {
|
||||||
return redirect()->route('prices')->with('error', __('あなたはcsvファイルを選択していません。'));
|
DB::rollBack();
|
||||||
|
return redirect()->route('prices')->with('error', $msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function info(Request $request, $id)
|
public function info(Request $request, $id)
|
||||||
{
|
{
|
||||||
return $this->edit($request, $id, 'admin.prices.info');
|
return $this->edit($request, $id, 'admin.prices.info');
|
||||||
|
|||||||
@ -9,22 +9,37 @@ use App\Models\Psection;
|
|||||||
class PsectionController extends Controller
|
class PsectionController extends Controller
|
||||||
{
|
{
|
||||||
// 一覧画面
|
// 一覧画面
|
||||||
public function list(Request $request)
|
public function list(Request $request)
|
||||||
{
|
{
|
||||||
// ソート順
|
$inputs = $request->all();
|
||||||
$sort = $request->input('sort', 'psection_id');
|
// ソート可能なカラム
|
||||||
$sort_type = $request->input('sort_type', 'asc');
|
$allowedSortColumns = ['psection_id', 'psection_subject'];
|
||||||
|
|
||||||
$query = Psection::query();
|
// ソート情報の取得
|
||||||
if (in_array($sort, ['psection_id', 'psection_subject'])) {
|
$sortColumn = $inputs['sort'] ?? 'psection_id';
|
||||||
$query->orderBy($sort, $sort_type);
|
$sortType = strtolower($inputs['sort_type'] ?? 'asc');
|
||||||
|
|
||||||
|
$query = \App\Models\Psection::query();
|
||||||
|
|
||||||
|
if (in_array($sortColumn, $allowedSortColumns, true)) {
|
||||||
|
if (!in_array($sortType, ['asc', 'desc'], true)) {
|
||||||
|
$sortType = 'asc';
|
||||||
|
}
|
||||||
|
$query->orderBy($sortColumn, $sortType);
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = $query->get();
|
// ページネーション(20件)
|
||||||
|
$list = $query->paginate(20);
|
||||||
|
|
||||||
return view('admin.psection.list', compact('list', 'sort', 'sort_type'));
|
return view('admin.psection.list', [
|
||||||
|
'list' => $list,
|
||||||
|
'sort' => $sortColumn,
|
||||||
|
'sort_type' => $sortType,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 新規追加
|
// 新規追加
|
||||||
public function add(Request $request)
|
public function add(Request $request)
|
||||||
{
|
{
|
||||||
@ -42,16 +57,26 @@ class PsectionController extends Controller
|
|||||||
// 編集
|
// 編集
|
||||||
public function edit(Request $request, $id)
|
public function edit(Request $request, $id)
|
||||||
{
|
{
|
||||||
|
// 主キーで検索(見つからない場合は 404)
|
||||||
$psection = Psection::findOrFail($id);
|
$psection = Psection::findOrFail($id);
|
||||||
|
|
||||||
if ($request->isMethod('post')) {
|
if ($request->isMethod('post')) {
|
||||||
|
// バリデーション
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
'psection_subject' => 'required|string|max:255',
|
'psection_subject' => 'required|string|max:255',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// データ更新
|
||||||
$psection->update($validated);
|
$psection->update($validated);
|
||||||
|
|
||||||
|
// 成功メッセージ & リダイレクト
|
||||||
return redirect()->route('psection')->with('success', '車種区分を更新しました');
|
return redirect()->route('psection')->with('success', '車種区分を更新しました');
|
||||||
}
|
}
|
||||||
return view('admin.psection.edit', compact('psection'));
|
|
||||||
}
|
// 編集画面を表示
|
||||||
|
return view('admin.psection.edit', compact('psection'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 詳細(info)
|
// 詳細(info)
|
||||||
public function info(Request $request, $id)
|
public function info(Request $request, $id)
|
||||||
|
|||||||
@ -21,6 +21,7 @@ class Price extends Model
|
|||||||
protected $primaryKey = 'price_parkplaceid';
|
protected $primaryKey = 'price_parkplaceid';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
'price_parkplaceid',
|
||||||
'prine_name',
|
'prine_name',
|
||||||
'price_month',
|
'price_month',
|
||||||
'park_id',
|
'park_id',
|
||||||
|
|||||||
@ -18,20 +18,33 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="card-body">
|
<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
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
@if($isEdit)
|
<!-- 駐車場所ID -->
|
||||||
<!-- 駐車場所ID -->
|
<div class="col-3">
|
||||||
<div class="col-3">
|
<label class="required">{{ __('駐車場所ID') }}</label>
|
||||||
<label class="required">{{ __('駐車場所ID') }}</label>
|
</div>
|
||||||
|
<div class="form-group col-9">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text"
|
||||||
|
name="price_parkplaceid"
|
||||||
|
value="{{ old('price_parkplaceid', $price_parkplaceid ?? '') }}"
|
||||||
|
class="form-control form-control-lg"
|
||||||
|
@if($isEdit) readonly @endif
|
||||||
|
placeholder="駐車場所ID" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-9">
|
</div>
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" value="{{ $price_parkplaceid }}" name="price_parkplaceid"
|
|
||||||
class="form-control form-control-lg" readonly />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<!-- 商品名 -->
|
<!-- 商品名 -->
|
||||||
<div class="form-group col-3">
|
<div class="form-group col-3">
|
||||||
@ -39,12 +52,15 @@
|
|||||||
</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="{{ $prine_name }}" name="prine_name"
|
<input type="text"
|
||||||
class="form-control form-control-lg" />
|
name="prine_name"
|
||||||
|
value="{{ old('prine_name', $prine_name ?? '') }}"
|
||||||
|
class="form-control form-control-lg"
|
||||||
|
placeholder="商品名" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 期間 -->
|
<!-- 期間 -->
|
||||||
<div class="form-group col-3">
|
<div class="form-group col-3">
|
||||||
<label class="required">{{ __('期間') }}</label>
|
<label class="required">{{ __('期間') }}</label>
|
||||||
</div>
|
</div>
|
||||||
@ -53,13 +69,15 @@
|
|||||||
<select name="price_month" class="form-control form-control-lg">
|
<select name="price_month" class="form-control form-control-lg">
|
||||||
<option value="">{{ __('期間') }}</option>
|
<option value="">{{ __('期間') }}</option>
|
||||||
@foreach(\App\Models\Price::PRICE_MONTH as $key => $item)
|
@foreach(\App\Models\Price::PRICE_MONTH as $key => $item)
|
||||||
<option value="{{ $key }}" @if($key == $price_month) selected @endif>{{ $item }}</option>
|
<option value="{{ $key }}"
|
||||||
|
@if($key == old('price_month', $price_month ?? '')) selected @endif>
|
||||||
|
{{ $item }}
|
||||||
|
</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- 駐輪場ID -->
|
<!-- 駐輪場ID -->
|
||||||
<div class="form-group col-3">
|
<div class="form-group col-3">
|
||||||
<label class="required">{{ __('駐輪場名') }}</label>
|
<label class="required">{{ __('駐輪場名') }}</label>
|
||||||
@ -69,13 +87,16 @@
|
|||||||
<select name="park_id" class="form-control form-control-lg">
|
<select name="park_id" class="form-control form-control-lg">
|
||||||
<option value="">{{ __('駐輪場名') }}</option>
|
<option value="">{{ __('駐輪場名') }}</option>
|
||||||
@foreach($parks as $key => $item)
|
@foreach($parks as $key => $item)
|
||||||
<option value="{{ $key }}" @if($key == $park_id) selected @endif>{{ $item }}</option>
|
<option value="{{ $key }}"
|
||||||
|
@if($key == old('park_id', $park_id ?? '')) selected @endif>
|
||||||
|
{{ $item }}
|
||||||
|
</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 車種区分名 -->
|
<!-- 車種区分名 -->
|
||||||
<div class="form-group col-3">
|
<div class="form-group col-3">
|
||||||
<label class="required">{{ __('車種区分名') }}</label>
|
<label class="required">{{ __('車種区分名') }}</label>
|
||||||
</div>
|
</div>
|
||||||
@ -84,7 +105,10 @@
|
|||||||
<select name="psection_id" class="form-control form-control-lg">
|
<select name="psection_id" class="form-control form-control-lg">
|
||||||
<option value="">{{ __('車種区分名') }}</option>
|
<option value="">{{ __('車種区分名') }}</option>
|
||||||
@foreach($psections as $key => $item)
|
@foreach($psections as $key => $item)
|
||||||
<option value="{{ $key }}" @if($key == $psection_id) selected @endif>{{ $item }}</option>
|
<option value="{{ $key }}"
|
||||||
|
@if($key == old('psection_id', $psection_id ?? '')) selected @endif>
|
||||||
|
{{ $item }}
|
||||||
|
</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -100,14 +124,13 @@
|
|||||||
<option value="">{{ __('駐輪分類名') }}</option>
|
<option value="">{{ __('駐輪分類名') }}</option>
|
||||||
@foreach($ptypes as $key => $item)
|
@foreach($ptypes as $key => $item)
|
||||||
<option value="{{ $key }}"
|
<option value="{{ $key }}"
|
||||||
@if(isset($price_ptypeid) && $key == $price_ptypeid) selected @endif>
|
@if($key == old('price_ptypeid', $price_ptypeid ?? '')) selected @endif>
|
||||||
{{ $item }}
|
{{ $item }}
|
||||||
</option>
|
</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 利用者分類 -->
|
<!-- 利用者分類 -->
|
||||||
<div class="form-group col-3">
|
<div class="form-group col-3">
|
||||||
<label class="required">{{ __('利用者分類') }}</label>
|
<label class="required">{{ __('利用者分類') }}</label>
|
||||||
@ -117,50 +140,64 @@
|
|||||||
<select name="user_categoryid" class="form-control form-control-lg">
|
<select name="user_categoryid" class="form-control form-control-lg">
|
||||||
<option value="">{{ __('利用者分類') }}</option>
|
<option value="">{{ __('利用者分類') }}</option>
|
||||||
@foreach($userTypes as $key => $item)
|
@foreach($userTypes as $key => $item)
|
||||||
<option value="{{ $key }}" @if($key == $user_categoryid) selected @endif>{{ $item }}</option>
|
<option value="{{ $key }}"
|
||||||
|
@if($key == old('user_categoryid', $user_categoryid ?? '')) selected @endif>
|
||||||
|
{{ $item }}
|
||||||
|
</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 駐車車室ID -->
|
<!-- 駐車車室ID -->
|
||||||
<div class="col-3">
|
<div class="form-group col-3">
|
||||||
<label class="required">{{ __('駐車車室ID') }}</label>
|
<label class="required">{{ __('駐車車室ID') }}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-9">
|
<div class="form-group col-9">
|
||||||
<div class="input-group">
|
<input type="text"
|
||||||
<input type="text" value="{{ $pplace_id }}" name="pplace_id"
|
name="pplace_id"
|
||||||
class="form-control form-control-lg" />
|
value="{{ old('pplace_id', $pplace_id ?? '') }}"
|
||||||
</div>
|
class="form-control form-control-lg"
|
||||||
</div>
|
placeholder="駐車車室ID">
|
||||||
|
|
||||||
|
@error('pplace_id')
|
||||||
|
<div class="text-danger">{{ $message }}</div>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- 駐輪料金(税込) -->
|
<!-- 駐輪料金(税込) -->
|
||||||
<div class="col-3">
|
<div class="form-group col-3">
|
||||||
<label class="required">{{ __('駐輪料金(税込)') }}</label>
|
<label class="required">{{ __('駐輪料金(税込)') }}</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="{{ $price }}" name="price"
|
<input type="number"
|
||||||
class="form-control form-control-lg" />
|
name="price"
|
||||||
|
value="{{ old('price', $price ?? '') }}"
|
||||||
|
class="form-control form-control-lg"
|
||||||
|
placeholder="駐輪料金(税込)"
|
||||||
|
step="1" min="0" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ▼ 下部ボタン --}}
|
||||||
|
<div class="form-group col-12 d-flex gap-2 mt-4">
|
||||||
{{-- 下部ボタン --}}
|
{{-- 登録ボタン --}}
|
||||||
@if($isEdit)
|
|
||||||
{{-- 編集画面 --}}
|
|
||||||
<button type="submit" class="btn btn-lg btn-success mr-2">{{ __('登録') }}</button>
|
<button type="submit" class="btn btn-lg btn-success mr-2">{{ __('登録') }}</button>
|
||||||
|
|
||||||
<form method="POST" action="{{ route('prices_delete', ['id' => $price_parkplaceid]) }}" class="d-inline">
|
{{-- 削除ボタン(編集画面のみ表示) --}}
|
||||||
@csrf
|
@if(!empty($price_parkplaceid))
|
||||||
@method('DELETE')
|
|
||||||
<button type="submit" class="btn btn-lg btn-danger">{{ __('削除') }}</button>
|
|
||||||
</form>
|
</form>
|
||||||
@else
|
<form method="POST" action="{{ route('prices_delete') }}"
|
||||||
{{-- 新規画面 --}}
|
onsubmit="return confirm('本当に削除しますか?')" class="d-inline-block mr-2">
|
||||||
<button type="submit" class="btn btn-lg btn-success">{{ __('登録') }}</button>
|
@csrf
|
||||||
@endif
|
<input type="hidden" name="pk" value="{{ $price_parkplaceid }}">
|
||||||
|
<button type="submit" class="btn btn-lg btn-danger mr-2">{{ __('削除') }}</button>
|
||||||
|
</form>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- /.card-body -->
|
<!-- /.card-body -->
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<form method="POST" action="{{ route('price_edit', ['id' => $price_parkplaceid]) }}" enctype="multipart/form-data">
|
<form method="POST" action="{{ route('price_edit', ['id' => $price_parkplaceid]) }}" enctype="multipart/form-data">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
|
||||||
@include('admin.prices._form', ['isEdit' => true])
|
@include('admin.prices._form', ['isEdit' => true])
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -31,31 +31,95 @@
|
|||||||
<input type="hidden" name="sort_type" value="{{ $sort_type ?? '' }}">
|
<input type="hidden" name="sort_type" value="{{ $sort_type ?? '' }}">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{{-- ▼ 各種アクションボタン群 --}}
|
{{-- ▼ 各種アクションボタン群 --}}
|
||||||
<div class="container-fluid mb20">
|
<div class="container-fluid mb20">
|
||||||
|
{{-- 新規 --}}
|
||||||
<button type="button" class="btn btn-sm btn-default mr10"
|
<button type="button" class="btn btn-sm btn-default mr10"
|
||||||
onclick="location.href='{{ route('price_add') }}'">新規</button>
|
onclick="location.href='{{ route('price_add') }}'">新規</button>
|
||||||
|
|
||||||
|
{{-- 削除 --}}
|
||||||
<button type="submit" class="btn btn-sm btn-default mr10"
|
<button type="submit" class="btn btn-sm btn-default mr10"
|
||||||
form="form_delete" name="delete" id="delete"
|
form="form_delete" name="delete"
|
||||||
onclick="return confirm('選択した項目を削除しますか?');">削除</button>
|
onclick="return confirm('選択した項目を削除しますか?');">削除</button>
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-default mr10"
|
{{-- CSV出力(全件 or ソート条件付き)--}}
|
||||||
name="export_csv" id="export_csv"
|
<form id="form_export" method="POST" action="{{ route('prices_export') }}" class="d-inline">
|
||||||
action="{{ route('prices_export') }}">CSV出力</button>
|
@csrf
|
||||||
|
<input type="hidden" name="sort" value="{{ $sort ?? '' }}">
|
||||||
|
<input type="hidden" name="sort_type" value="{{ $sort_type ?? '' }}">
|
||||||
|
<button type="submit" class="btn btn-sm btn-default mr10">CSV出力</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-default mr10"
|
{{-- エクスポート(条件選択モーダル) --}}
|
||||||
name="import_csv" id="import_csv"
|
<button type="button" class="btn btn-sm btn-default mr10" data-toggle="modal" data-target="#exportModal">
|
||||||
action="{{ route('prices_import') }}">インポート</button>
|
エクスポート
|
||||||
|
</button>
|
||||||
|
|
||||||
<button type="button" class="btn btn-sm btn-default mr10"
|
{{-- インポート(モーダル) --}}
|
||||||
onclick="location.href='{{ route('prices_export') }}'">エクスポート</button>
|
<button type="button" class="btn btn-sm btn-default mr10" data-toggle="modal" data-target="#importModal">
|
||||||
|
インポート
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- エクスポート用モーダル --}}
|
||||||
|
<div class="modal fade" id="exportModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form method="POST" action="{{ route('prices_export') }}">
|
||||||
|
@csrf
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>エクスポートする駐輪場を選択してください。</p>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="park_id" class="col-sm-4 col-form-label">駐輪場名</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<select name="park_id" id="park_id" class="form-control">
|
||||||
|
@foreach($parks as $id => $name)
|
||||||
|
<option value="{{ $id }}">{{ $name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer justify-content-center">
|
||||||
|
<button type="submit" class="btn btn-primary w-25">OK</button>
|
||||||
|
<button type="button" class="btn btn-secondary w-25" data-dismiss="modal">キャンセル</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- インポート用モーダル --}}
|
||||||
|
<div class="modal fade" id="importModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form method="POST" action="{{ route('prices_import') }}" enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>料金表をインポートします。ファイルを選択してください。</p>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="import_file" class="col-sm-4 col-form-label">ファイル名</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="file" name="file" id="import_file" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer justify-content-center">
|
||||||
|
<button type="submit" class="btn btn-primary w-25">OK</button>
|
||||||
|
<button type="button" class="btn btn-secondary w-25" data-dismiss="modal">キャンセル</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- ▼ ページネーション --}}
|
{{-- ▼ ページネーション --}}
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="d-flex justify-content-end mb-3">
|
<div class="d-flex justify-content-end mb-3">
|
||||||
{{ $list->appends(['sort' => $sort ?? '', 'sort_type' => $sort_type ?? ''])->links('pagination') }}
|
{{ $list->appends([
|
||||||
|
'sort' => $sort ?? '',
|
||||||
|
'sort_type' => $sort_type ?? ''
|
||||||
|
])->links('pagination') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
<div class="content-header">
|
<div class="content-header">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<div class="col-lg-6"><h1 class="m-0 text-dark">車種区分新規登録</h1></div>
|
<div class="col-lg-6"><h1 class="m-0 text-dark">新規登録</h1></div>
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<ol class="breadcrumb float-sm-right text-sm">
|
<ol class="breadcrumb float-sm-right text-sm">
|
||||||
<li class="breadcrumb-item"><a href="{{ url('/home') }}">ホーム</a></li>
|
<li class="breadcrumb-item"><a href="{{ url('/home') }}">ホーム</a></li>
|
||||||
<li class="breadcrumb-item"><a href="{{ route('psection') }}">車種区分マスタ</a></li>
|
<li class="breadcrumb-item"><a href="{{ route('psection') }}">車種区分マスタ</a></li>
|
||||||
<li class="breadcrumb-item active">新規</li>
|
<li class="breadcrumb-item active">新規登録</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -18,7 +18,6 @@
|
|||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|
||||||
{{-- 显示错误信息 --}}
|
|
||||||
@if ($errors->any())
|
@if ($errors->any())
|
||||||
<div class="alert alert-danger">
|
<div class="alert alert-danger">
|
||||||
<ul>
|
<ul>
|
||||||
@ -39,9 +38,9 @@
|
|||||||
<label>車種区分名 <span class="text-danger">*</span></label>
|
<label>車種区分名 <span class="text-danger">*</span></label>
|
||||||
<input type="text" name="psection_subject" class="form-control" value="{{ old('psection_subject') }}" required>
|
<input type="text" name="psection_subject" class="form-control" value="{{ old('psection_subject') }}" required>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary"
|
<button type="submit" class="btn btn-lg btn-success"
|
||||||
onclick="return confirm('保存してもよろしいですか?');">登録</button>
|
onclick="return confirm('保存してもよろしいですか?');">登録</button>
|
||||||
<a href="{{ route('psection') }}" class="btn btn-secondary">戻る</a>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@ -1,35 +1,69 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
@section('title', '車種区分新規登録')
|
|
||||||
|
@section('title', '車種区分マスタ 編集')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content-header">
|
<div class="content-header">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<div class="col-lg-6"><h1 class="m-0 text-dark">車種区分新規登録</h1></div>
|
<div class="col-lg-6">
|
||||||
|
<h1 class="m-0 text-dark">車種区分マスタ 編集</h1>
|
||||||
|
</div>
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<ol class="breadcrumb float-sm-right text-sm">
|
<ol class="breadcrumb float-sm-right text-sm">
|
||||||
<li class="breadcrumb-item"><a href="{{ url('/home') }}">ホーム</a></li>
|
<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('psection') }}">車種区分マスタ</a></li>
|
||||||
<li class="breadcrumb-item active">新規</li>
|
<li class="breadcrumb-item active">編集</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<form method="POST" action="{{ route('psection_add') }}">
|
<div class="card">
|
||||||
@csrf
|
<form method="POST" action="{{ route('psection_edit', ['id' => $psection->psection_id]) }}">
|
||||||
<div class="form-group">
|
@csrf
|
||||||
<label>車種区分ID <span class="text-danger">*</span></label>
|
<div class="card-body">
|
||||||
<input type="number" name="psection_id" class="form-control" value="{{ old('psection_id') }}" required>
|
{{-- 車種区分ID(読み取り専用) --}}
|
||||||
</div>
|
<div class="form-group row">
|
||||||
<div class="form-group">
|
<label class="col-3 col-form-label">車種区分ID</label>
|
||||||
<label>車種区分名 <span class="text-danger">*</span></label>
|
<div class="col-9">
|
||||||
<input type="text" name="psection_subject" class="form-control" value="{{ old('psection_subject') }}" required>
|
<input type="text" class="form-control" value="{{ $psection->psection_id }}" readonly>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">登録</button>
|
</div>
|
||||||
<a href="{{ route('psection') }}" class="btn btn-secondary">戻る</a>
|
|
||||||
</form>
|
{{-- 車種区分名 --}}
|
||||||
|
<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>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@ -23,61 +23,51 @@
|
|||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|
||||||
{{-- ▼ アクションボタン(市区マスタ準拠) --}}
|
{{-- ▼ アクションボタン --}}
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<a href="{{ route('psection_add') }}" class="btn btn-sm btn-primary">新規</a>
|
<a href="{{ route('psection_add') }}" class="btn btn-sm btn-default">新規</a>
|
||||||
<button type="submit" form="deleteForm" class="btn btn-sm btn-danger ml-2"
|
<button type="submit" form="deleteForm" class="btn btn-sm btn-default ml-2"
|
||||||
onclick="return confirm('選択した区分を削除しますか?');">削除</button>
|
onclick="return confirm('選択した区分を削除しますか?');">削除</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- ▼ ページネーション --}}
|
||||||
|
<div class="d-flex justify-content-end mb-3">
|
||||||
|
{{ $list->appends([
|
||||||
|
'sort' => $sort ?? '',
|
||||||
|
'sort_type' => $sort_type ?? ''
|
||||||
|
])->links('pagination') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
@if ($list->count() > 0)
|
@if ($list->count() > 0)
|
||||||
<form id="deleteForm" method="POST" action="{{ route('psection_delete') }}">
|
<form id="deleteForm" method="POST" action="{{ route('psection_delete') }}">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-bordered table-hover" style="min-width:600px;">
|
<table class="table table-bordered dataTable text-nowrap">
|
||||||
<thead class="thead-light">
|
<thead class="thead-light">
|
||||||
<tr>
|
<tr>
|
||||||
{{-- ▼ 統合列:チェック + 編集(背景色は #faebd7) --}}
|
{{-- ▼ 統合列:チェック + 編集 --}}
|
||||||
<th style="width:140px;">
|
<th style="width:140px;">
|
||||||
<input type="checkbox" onclick="$('input[name*=\'pk\']').prop('checked', this.checked);">
|
<input type="checkbox" onclick="$('input[name*=\'pk\']').prop('checked', this.checked);">
|
||||||
<span class="text-muted" style="font-weight:normal;"></span>
|
<span class="text-muted" style="font-weight:normal;"></span>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
{{-- ▼ 表頭:ソート対応(ID / 名称) --}}
|
{{-- ▼ ソート対象列 --}}
|
||||||
<th style="width:140px; text-align:center;">
|
<th class="sorting {{ ($sort=='psection_id') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"
|
||||||
<a href="{{ route('psection', ['sort' => 'id', 'direction' => ($sort=='id' && $direction=='asc')?'desc':'asc']) }}"
|
sort="psection_id">
|
||||||
style="color:inherit; text-decoration:none;">
|
<span>車種区分ID</span>
|
||||||
車種区分ID
|
|
||||||
@if($sort == 'id')
|
|
||||||
@if($direction == 'asc')
|
|
||||||
<span style="font-size:1.0em;">▲</span>
|
|
||||||
@else
|
|
||||||
<span style="font-size:1.0em;">▼</span>
|
|
||||||
@endif
|
|
||||||
@endif
|
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th style="text-align:center;">
|
<th class="sorting {{ ($sort=='psection_subject') ? ($sort_type=='asc'?'sorting_asc':'sorting_desc') : '' }}"
|
||||||
<a href="{{ route('psection', ['sort' => 'subject', 'direction' => ($sort=='subject' && $direction=='asc')?'desc':'asc']) }}"
|
sort="psection_subject">
|
||||||
style="color:inherit; text-decoration:none;">
|
<span>車種区分名</span>
|
||||||
車種区分名
|
|
||||||
@if($sort == 'subject')
|
|
||||||
@if($direction == 'asc')
|
|
||||||
<span style="font-size:1.0em;">▲</span>
|
|
||||||
@else
|
|
||||||
<span style="font-size:1.0em;">▼</span>
|
|
||||||
@endif
|
|
||||||
@endif
|
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody class="bg-white">
|
||||||
@foreach ($list as $item)
|
@foreach ($list as $item)
|
||||||
<tr>
|
<tr>
|
||||||
{{-- ▼ 統合セル:チェック + 編集(市区マスタの老書式に合わせる) --}}
|
{{-- ▼ 統合セル:チェック + 編集 --}}
|
||||||
<td style="background: #faebd7;">
|
<td style="background: #faebd7;">
|
||||||
<input type="checkbox" name="pk[]" value="{{ $item->psection_id }}">
|
<input type="checkbox" name="pk[]" value="{{ $item->psection_id }}">
|
||||||
<a href="{{ route('psection_edit', ['id' => $item->psection_id]) }}"
|
<a href="{{ route('psection_edit', ['id' => $item->psection_id]) }}"
|
||||||
@ -99,4 +89,26 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
{{-- ▼ ソート用スクリプト --}}
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
document.querySelectorAll("th.sorting, th.sorting_asc, th.sorting_desc").forEach(function(th) {
|
||||||
|
th.addEventListener("click", function() {
|
||||||
|
const sort = this.getAttribute("sort");
|
||||||
|
let sortType = "{{ $sort_type }}";
|
||||||
|
if ("{{ $sort }}" === sort) {
|
||||||
|
sortType = (sortType === "asc") ? "desc" : "asc";
|
||||||
|
} else {
|
||||||
|
sortType = "asc";
|
||||||
|
}
|
||||||
|
const url = new URL(window.location.href);
|
||||||
|
url.searchParams.set("sort", sort);
|
||||||
|
url.searchParams.set("sort_type", sortType);
|
||||||
|
window.location.href = url.toString();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@ -208,11 +208,11 @@
|
|||||||
|
|
||||||
{{-- 下部ボタン --}}
|
{{-- 下部ボタン --}}
|
||||||
@if($isEdit)
|
@if($isEdit)
|
||||||
<button type="submit" class="btn btn-lg btn-success register">{{ __('保存') }}</button>
|
<button type="submit" class="btn btn-lg btn-success register">{{ __('登録') }}</button>
|
||||||
<button type="submit" class="btn btn-lg btn-secondary register">{{ __('戻る') }}</button>
|
<button type="submit" class="btn btn-lg btn-danger register">{{ __('削除') }}</button>
|
||||||
@else
|
@else
|
||||||
<button type="submit" class="btn btn-lg btn-success register">{{ __('登録') }}</button>
|
<button type="submit" class="btn btn-lg btn-success register">{{ __('登録') }}</button>
|
||||||
<button type="submit" class="btn btn-lg btn-danger register">{{ __('削除') }}</button>
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -83,11 +83,11 @@
|
|||||||
<div class="form-group col-12 text-left">
|
<div class="form-group col-12 text-left">
|
||||||
@if(isset($zone) && $zone->zone_id)
|
@if(isset($zone) && $zone->zone_id)
|
||||||
{{-- 編集画面 --}}
|
{{-- 編集画面 --}}
|
||||||
<button type="submit" class="btn btn-primary">保存</button>
|
<button type="submit" class="btn btn-success">登録</button>
|
||||||
<a href="{{ route('zones') }}" class="btn btn-secondary">戻る</a>
|
<a href="{{ route('zones') }}" class="btn btn-secondary">削除</a>
|
||||||
@else
|
@else
|
||||||
{{-- 新規画面 --}}
|
{{-- 新規画面 --}}
|
||||||
<button type="submit" class="btn btn-success">登録</button>
|
<button type="submit" class="btn btn-success">登録</button>
|
||||||
<a href="{{ route('zones') }}" class="btn btn-secondary">削除</a>
|
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -183,7 +183,8 @@ 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/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/delete', [PriceController::class, 'delete'])->name('prices_delete');
|
||||||
Route::match(['get', 'post'], '/admin/prices/import', [PriceController::class, 'import'])->name('prices_import');
|
Route::match(['get', 'post'], '/admin/prices/import', [PriceController::class, 'import'])->name('prices_import');
|
||||||
Route::get('/admin/prices/export', [PriceController::class, 'export'])->name('prices_export');
|
// kin 修正
|
||||||
|
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', [PsectionController::class, 'list'])->name('psection');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user